comparison src/share/vm/utilities/elfFile.cpp @ 8883:b9a918201d47

Merge with hsx25
author Gilles Duboscq <duboscq@ssw.jku.at>
date Sat, 06 Apr 2013 20:04:06 +0200
parents 9058789475af
children de6a9e811145 e7cbc95179c4
comparison
equal deleted inserted replaced
8660:d47b52b0ff68 8883:b9a918201d47
195 p = p->m_next; 195 p = p->m_next;
196 } 196 }
197 return NULL; 197 return NULL;
198 } 198 }
199 199
200 #ifdef LINUX
201 bool ElfFile::specifies_noexecstack() {
202 Elf_Phdr phdr;
203 if (!m_file) return true;
204
205 if (!fseek(m_file, m_elfHdr.e_phoff, SEEK_SET)) {
206 for (int index = 0; index < m_elfHdr.e_phnum; index ++) {
207 if (fread((void*)&phdr, sizeof(Elf_Phdr), 1, m_file) != 1) {
208 m_status = NullDecoder::file_invalid;
209 return false;
210 }
211 if (phdr.p_type == PT_GNU_STACK) {
212 if (phdr.p_flags == (PF_R | PF_W)) {
213 return true;
214 } else {
215 return false;
216 }
217 }
218 }
219 }
220 return false;
221 }
222 #endif
223
200 #endif // _WINDOWS 224 #endif // _WINDOWS