[ELF] Set header flags to 0 by default

llvm-svn: 176279
This commit is contained in:
Shankar Easwaran 2013-02-28 18:36:34 +00:00
parent dac3873442
commit 937aa19a4b
2 changed files with 6 additions and 3 deletions

View File

@ -566,7 +566,10 @@ template <class ELFT> void DefaultLayout<ELFT>::assignSectionsToSegments() {
section->setSegmentType(segmentType);
StringRef segmentName = section->segmentKindToStr();
int64_t sectionFlag = msi->flags();
int64_t lookupSectionFlag = msi->flags();
if (!(lookupSectionFlag & llvm::ELF::SHF_WRITE))
lookupSectionFlag &= ~llvm::ELF::SHF_EXECINSTR;
lookupSectionFlag &= ~(llvm::ELF::SHF_STRINGS | llvm::ELF::SHF_MERGE);
Segment<ELFT> *segment;
// We need a seperate segment for sections that dont have
@ -589,7 +592,7 @@ template <class ELFT> void DefaultLayout<ELFT>::assignSectionsToSegments() {
}
// Use the flags of the merged Section for the segment
const SegmentKey key("PT_LOAD", sectionFlag);
const SegmentKey key("PT_LOAD", lookupSectionFlag);
const std::pair<SegmentKey, Segment<ELFT> *> currentSegment(key,
nullptr);
std::pair<typename SegmentMapT::iterator, bool> segmentInsert(

View File

@ -72,7 +72,7 @@ Header<ELFT>::Header(const ELFTargetInfo &ti)
e_ident(llvm::ELF::EI_MAG2, 'L');
e_ident(llvm::ELF::EI_MAG3, 'F');
e_ehsize(sizeof(Elf_Ehdr));
e_flags(2);
e_flags(0);
}
template <class ELFT>