[lld] r176279 - [ELF] Set header flags to 0 by default
Shankar Easwaran
shankare at codeaurora.org
Thu Feb 28 10:36:34 PST 2013
Author: shankare
Date: Thu Feb 28 12:36:34 2013
New Revision: 176279
URL: http://llvm.org/viewvc/llvm-project?rev=176279&view=rev
Log:
[ELF] Set header flags to 0 by default
Modified:
lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h
Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=176279&r1=176278&r2=176279&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Thu Feb 28 12:36:34 2013
@@ -566,7 +566,10 @@ template <class ELFT> void DefaultLayout
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
}
// 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(
Modified: lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h?rev=176279&r1=176278&r2=176279&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h Thu Feb 28 12:36:34 2013
@@ -72,7 +72,7 @@ Header<ELFT>::Header(const ELFTargetInfo
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>
More information about the llvm-commits
mailing list