[ELF2] - Implemented PT_GNU_STACK support, -z execstack option.

PT_GNU_STACK is a entry in the elf file format which contains the access rights (read, write, execute) of the stack,
it is always generated now. By default stack is not executable in this implementation. 
-z execstack can be used to make executable.

Differential revision: http://reviews.llvm.org/D14571

llvm-svn: 253145
This commit is contained in:
George Rimar
2015-11-14 20:56:08 +00:00
parent 0de179b23b
commit 03220309e1
24 changed files with 231 additions and 98 deletions

View File

@@ -219,7 +219,9 @@ void elf2::ObjectFile<ELFT>::initializeSections(DenseSet<StringRef> &Comdats) {
default: {
ErrorOr<StringRef> NameOrErr = this->ELFObj.getSectionName(&Sec);
error(NameOrErr);
if (*NameOrErr == ".eh_frame")
if (*NameOrErr == ".note.GNU-stack")
Sections[I] = &InputSection<ELFT>::Discarded;
else if (*NameOrErr == ".eh_frame")
Sections[I] = new (this->Alloc) EHInputSection<ELFT>(this, &Sec);
else if (shouldMerge<ELFT>(Sec))
Sections[I] = new (this->Alloc) MergeInputSection<ELFT>(this, &Sec);