Mercurial > hg > truffle
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/utilities/elfFile.cpp Fri Apr 05 18:53:57 2013 +0200 +++ b/src/share/vm/utilities/elfFile.cpp Sat Apr 06 20:04:06 2013 +0200 @@ -197,4 +197,28 @@ return NULL; } +#ifdef LINUX +bool ElfFile::specifies_noexecstack() { + Elf_Phdr phdr; + if (!m_file) return true; + + if (!fseek(m_file, m_elfHdr.e_phoff, SEEK_SET)) { + for (int index = 0; index < m_elfHdr.e_phnum; index ++) { + if (fread((void*)&phdr, sizeof(Elf_Phdr), 1, m_file) != 1) { + m_status = NullDecoder::file_invalid; + return false; + } + if (phdr.p_type == PT_GNU_STACK) { + if (phdr.p_flags == (PF_R | PF_W)) { + return true; + } else { + return false; + } + } + } + } + return false; +} +#endif + #endif // _WINDOWS