[lld] r189209 - [lld][ELF] Cleanup ELF writing, No change in functionality
Shankar Easwaran
shankare at codeaurora.org
Sun Aug 25 20:16:13 PDT 2013
Author: shankare
Date: Sun Aug 25 22:16:13 2013
New Revision: 189209
URL: http://llvm.org/viewvc/llvm-project?rev=189209&view=rev
Log:
[lld][ELF] Cleanup ELF writing, No change in functionality
The cleanup includes :-
* Rename ambiguous Header class to ELFHeader
* Convert Chunk contentype and kind to be a enumerated class
* Remove functions that are not being used, avoids future confusion
Modified:
lld/trunk/lib/ReaderWriter/ELF/Chunk.h
lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h
lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h
lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h
Modified: lld/trunk/lib/ReaderWriter/ELF/Chunk.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Chunk.h?rev=189209&r1=189208&r2=189209&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Chunk.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Chunk.h Sun Aug 25 22:16:13 2013
@@ -33,30 +33,20 @@ class Chunk {
public:
/// \brief Describes the type of Chunk
- enum Kind {
- K_Header, ///< ELF Header
- K_ProgramHeader, ///< Program Header
- K_ELFSegment, ///< Segment
- K_ELFSection, ///< Section
- K_AtomSection, ///< A section containing atoms.
- K_SectionHeader ///< Section header
+ enum Kind : uint8_t{ ELFHeader, ///< ELF Header
+ ProgramHeader, ///< Program Header
+ SectionHeader, ///< Section header
+ ELFSegment, ///< Segment
+ ELFSection, ///< Section
+ AtomSection ///< A section containing atoms.
};
/// \brief the ContentType of the chunk
- enum ContentType {
- CT_Unknown,
- CT_Header,
- CT_Code,
- CT_Data,
- CT_Note,
- CT_Tls,
- };
+ enum ContentType : uint8_t{ Unknown, Header, Code, Data, Note, TLS };
Chunk(StringRef name, Kind kind, const ELFLinkingContext &context)
: _name(name), _kind(kind), _fsize(0), _msize(0), _align2(0), _order(0),
_ordinal(1), _start(0), _fileoffset(0), _context(context) {}
virtual ~Chunk() {}
- // Does the chunk occupy disk space
- virtual bool occupiesNoDiskSpace() const { return false; }
// The name of the chunk
StringRef name() const { return _name; }
// Kind of chunk
@@ -76,8 +66,8 @@ public:
// Output start address of the chunk
void setVAddr(uint64_t start) { _start = start; }
uint64_t virtualAddr() const { return _start; }
- // Does the chunk occupy memory during execution ?
- uint64_t memSize() const { return _msize; }
+ // Memory size of the chunk
+ uint64_t memSize() const { return _msize; }
void setMemSize(uint64_t msize) { _msize = msize; }
// Whats the contentType of the chunk ?
virtual int getContentType() const = 0;
Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=189209&r1=189208&r2=189209&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Sun Aug 25 22:16:13 2013
@@ -230,9 +230,7 @@ public:
return false;
}
- inline void setHeader(Header<ELFT> *e) {
- _header = e;
- }
+ inline void setHeader(ELFHeader<ELFT> *elfHeader) { _elfHeader = elfHeader; }
inline void setProgramHeader(ProgramHeader<ELFT> *p) {
_programHeader = p;
@@ -244,9 +242,7 @@ public:
inline range<ChunkIter> segments() { return _segments; }
- inline Header<ELFT> *getHeader() {
- return _header;
- }
+ inline ELFHeader<ELFT> *getHeader() { return _elfHeader; }
inline ProgramHeader<ELFT> *getProgramHeader() {
return _programHeader;
@@ -300,7 +296,7 @@ private:
std::vector<Chunk<ELFT> *> _sections;
std::vector<Segment<ELFT> *> _segments;
std::vector<MergedSections<ELFT> *> _mergedSections;
- Header<ELFT> *_header;
+ ELFHeader<ELFT> *_elfHeader;
ProgramHeader<ELFT> *_programHeader;
LLD_UNIQUE_BUMP_PTR(RelocationTable<ELFT>) _dynamicRelocationTable;
LLD_UNIQUE_BUMP_PTR(RelocationTable<ELFT>) _pltRelocationTable;
@@ -648,7 +644,7 @@ template <class ELFT> void DefaultLayout
Segment<ELFT> *segment =
new (_allocator) ProgramHeaderSegment<ELFT>(_context);
_segments.push_back(segment);
- segment->append(_header);
+ segment->append(_elfHeader);
segment->append(_programHeader);
}
}
@@ -693,7 +689,7 @@ DefaultLayout<ELFT>::assignVirtualAddres
}
}
firstLoadSegment->prepend(_programHeader);
- firstLoadSegment->prepend(_header);
+ firstLoadSegment->prepend(_elfHeader);
bool newSegmentHeaderAdded = true;
while (true) {
for (auto si : _segments) {
Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h?rev=189209&r1=189208&r2=189209&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultTargetHandler.h Sun Aug 25 22:16:13 2013
@@ -26,9 +26,9 @@ public:
DefaultTargetHandler(ELFLinkingContext &context)
: TargetHandler<ELFT>(context) {}
- bool doesOverrideHeader() { return false; }
+ bool doesOverrideELFHeader() { return false; }
- void setHeaderInfo(Header<ELFT> *Header) {
+ void setELFHeader(ELFHeader<ELFT> *elfHeader) {
llvm_unreachable("Target should provide implementation for function ");
}
Modified: lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h?rev=189209&r1=189208&r2=189209&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/HeaderChunks.h Sun Aug 25 22:16:13 2013
@@ -24,12 +24,11 @@
/// start of an ELF executable file.
namespace lld {
namespace elf {
-template<class ELFT>
-class Header : public Chunk<ELFT> {
+template <class ELFT> class ELFHeader : public Chunk<ELFT> {
public:
typedef llvm::object::Elf_Ehdr_Impl<ELFT> Elf_Ehdr;
- Header(const ELFLinkingContext &);
+ ELFHeader(const ELFLinkingContext &);
void e_ident(int I, unsigned char C) { _eh.e_ident[I] = C; }
void e_type(uint16_t type) { _eh.e_type = type; }
@@ -48,12 +47,10 @@ public:
uint64_t fileSize() { return sizeof (Elf_Ehdr); }
static inline bool classof(const Chunk<ELFT> *c) {
- return c->Kind() == Chunk<ELFT>::K_Header;
+ return c->Kind() == Chunk<ELFT>::Kind::ELFHeader;
}
- inline int getContentType() const {
- return Chunk<ELFT>::CT_Header;
- }
+ inline int getContentType() const { return Chunk<ELFT>::ContentType::Header; }
void write(ELFWriter *writer, llvm::FileOutputBuffer &buffer);
@@ -66,8 +63,8 @@ private:
};
template <class ELFT>
-Header<ELFT>::Header(const ELFLinkingContext &context)
- : Chunk<ELFT>("elfhdr", Chunk<ELFT>::K_Header, context) {
+ELFHeader<ELFT>::ELFHeader(const ELFLinkingContext &context)
+ : Chunk<ELFT>("elfhdr", Chunk<ELFT>::Kind::ELFHeader, context) {
this->_align2 = ELFT::Is64Bits ? 8 : 4;
this->_fsize = sizeof(Elf_Ehdr);
this->_msize = sizeof(Elf_Ehdr);
@@ -81,7 +78,7 @@ Header<ELFT>::Header(const ELFLinkingCon
}
template <class ELFT>
-void Header<ELFT>::write(ELFWriter *writer, llvm::FileOutputBuffer &buffer) {
+void ELFHeader<ELFT>::write(ELFWriter *writer, llvm::FileOutputBuffer &buffer) {
uint8_t *chunkBuffer = buffer.getBufferStart();
uint8_t *atomContent = chunkBuffer + this->fileOffset();
memcpy(atomContent, &_eh, fileSize());
@@ -118,7 +115,7 @@ public:
};
ProgramHeader(const ELFLinkingContext &context)
- : Chunk<ELFT>("elfphdr", Chunk<ELFT>::K_ProgramHeader, context) {
+ : Chunk<ELFT>("elfphdr", Chunk<ELFT>::Kind::ProgramHeader, context) {
this->_align2 = ELFT::Is64Bits ? 8 : 4;
resetProgramHeaders();
}
@@ -132,7 +129,7 @@ public:
}
static inline bool classof(const Chunk<ELFT> *c) {
- return c->Kind() == Chunk<ELFT>::K_ProgramHeader;
+ return c->Kind() == Chunk<ELFT>::Kind::ProgramHeader;
}
void write(ELFWriter *writer, llvm::FileOutputBuffer &buffer);
@@ -166,9 +163,7 @@ public:
return _ph.size();
}
- inline int getContentType() const {
- return Chunk<ELFT>::CT_Header;
- }
+ inline int getContentType() const { return Chunk<ELFT>::ContentType::Header; }
private:
Elf_Phdr *allocateProgramHeader(bool &allocatedNew) {
@@ -260,7 +255,7 @@ public:
void updateSection(Section<ELFT> *section);
static inline bool classof(const Chunk<ELFT> *c) {
- return c->getChunkKind() == Chunk<ELFT>::K_SectionHeader;
+ return c->getChunkKind() == Chunk<ELFT>::Kind::SectionHeader;
}
void setStringSection(StringTable<ELFT> *s) {
@@ -279,9 +274,7 @@ public:
return sizeof(Elf_Shdr);
}
- inline int getContentType() const {
- return Chunk<ELFT>::CT_Header;
- }
+ inline int getContentType() const { return Chunk<ELFT>::ContentType::Header; }
inline uint64_t numHeaders() {
return _sectionInfo.size();
@@ -296,7 +289,7 @@ private:
template <class ELFT>
SectionHeader<ELFT>::SectionHeader(const ELFLinkingContext &context,
int32_t order)
- : Chunk<ELFT>("shdr", Chunk<ELFT>::K_SectionHeader, context) {
+ : Chunk<ELFT>("shdr", Chunk<ELFT>::Kind::SectionHeader, context) {
this->_fsize = 0;
this->_align2 = 8;
this->setOrder(order);
Modified: lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h?rev=189209&r1=189208&r2=189209&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Hexagon/HexagonTargetHandler.h Sun Aug 25 22:16:13 2013
@@ -148,13 +148,13 @@ class HexagonTargetHandler LLVM_FINAL :
public:
HexagonTargetHandler(HexagonLinkingContext &targetInfo);
- bool doesOverrideHeader() { return true; }
+ bool doesOverrideELFHeader() { return true; }
- void setHeaderInfo(Header<HexagonELFType> *header) {
- header->e_ident(llvm::ELF::EI_VERSION, 1);
- header->e_ident(llvm::ELF::EI_OSABI, 0);
- header->e_version(1);
- header->e_flags(0x3);
+ void setELFHeader(ELFHeader<HexagonELFType> *elfHeader) {
+ elfHeader->e_ident(llvm::ELF::EI_VERSION, 1);
+ elfHeader->e_ident(llvm::ELF::EI_OSABI, 0);
+ elfHeader->e_version(1);
+ elfHeader->e_flags(0x3);
}
virtual HexagonTargetLayout<HexagonELFType> &targetLayout() {
Modified: lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h?rev=189209&r1=189208&r2=189209&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/OutputELFWriter.h Sun Aug 25 22:16:13 2013
@@ -109,7 +109,7 @@ protected:
typedef llvm::DenseMap<const Atom *, uint64_t> AtomToAddress;
AtomToAddress _atomToAddressMap;
TargetLayout<ELFT> *_layout;
- LLD_UNIQUE_BUMP_PTR(Header<ELFT>) _Header;
+ LLD_UNIQUE_BUMP_PTR(ELFHeader<ELFT>) _elfHeader;
LLD_UNIQUE_BUMP_PTR(ProgramHeader<ELFT>) _programHeader;
LLD_UNIQUE_BUMP_PTR(SymbolTable<ELFT>) _symtab;
LLD_UNIQUE_BUMP_PTR(StringTable<ELFT>) _strtab;
@@ -209,8 +209,8 @@ template<class ELFT>
void OutputELFWriter<ELFT>::buildSectionHeaderTable() {
ScopedTask task(getDefaultDomain(), "buildSectionHeaderTable");
for (auto mergedSec : _layout->mergedSections()) {
- if (mergedSec->kind() != Chunk<ELFT>::K_ELFSection &&
- mergedSec->kind() != Chunk<ELFT>::K_AtomSection)
+ if (mergedSec->kind() != Chunk<ELFT>::Kind::ELFSection &&
+ mergedSec->kind() != Chunk<ELFT>::Kind::AtomSection)
continue;
if (mergedSec->hasSegment())
_shdrtab->appendSection(mergedSec);
@@ -221,8 +221,8 @@ template<class ELFT>
void OutputELFWriter<ELFT>::assignSectionsWithNoSegments() {
ScopedTask task(getDefaultDomain(), "assignSectionsWithNoSegments");
for (auto mergedSec : _layout->mergedSections()) {
- if (mergedSec->kind() != Chunk<ELFT>::K_ELFSection &&
- mergedSec->kind() != Chunk<ELFT>::K_AtomSection)
+ if (mergedSec->kind() != Chunk<ELFT>::Kind::ELFSection &&
+ mergedSec->kind() != Chunk<ELFT>::Kind::AtomSection)
continue;
if (!mergedSec->hasSegment())
_shdrtab->appendSection(mergedSec);
@@ -247,9 +247,9 @@ void OutputELFWriter<ELFT>::addFiles(Inp
}
template <class ELFT> void OutputELFWriter<ELFT>::createDefaultSections() {
- _Header.reset(new (_alloc) Header<ELFT>(_context));
+ _elfHeader.reset(new (_alloc) ELFHeader<ELFT>(_context));
_programHeader.reset(new (_alloc) ProgramHeader<ELFT>(_context));
- _layout->setHeader(_Header.get());
+ _layout->setHeader(_elfHeader.get());
_layout->setProgramHeader(_programHeader.get());
_symtab.reset(new (_alloc) SymbolTable<ELFT>(
@@ -365,37 +365,38 @@ error_code OutputELFWriter<ELFT>::writeF
if (ec)
return ec;
- _Header->e_ident(ELF::EI_CLASS,
- _context.is64Bits() ? ELF::ELFCLASS64 : ELF::ELFCLASS32);
- _Header->e_ident(ELF::EI_DATA, _context.isLittleEndian() ? ELF::ELFDATA2LSB
- : ELF::ELFDATA2MSB);
- _Header->e_type(_context.getOutputType());
- _Header->e_machine(_context.getOutputMachine());
-
- if (!_targetHandler.doesOverrideHeader()) {
- _Header->e_ident(ELF::EI_VERSION, 1);
- _Header->e_ident(ELF::EI_OSABI, 0);
- _Header->e_version(1);
+ _elfHeader->e_ident(ELF::EI_CLASS,
+ _context.is64Bits() ? ELF::ELFCLASS64 : ELF::ELFCLASS32);
+ _elfHeader->e_ident(ELF::EI_DATA, _context.isLittleEndian()
+ ? ELF::ELFDATA2LSB
+ : ELF::ELFDATA2MSB);
+ _elfHeader->e_type(_context.getOutputType());
+ _elfHeader->e_machine(_context.getOutputMachine());
+
+ if (!_targetHandler.doesOverrideELFHeader()) {
+ _elfHeader->e_ident(ELF::EI_VERSION, 1);
+ _elfHeader->e_ident(ELF::EI_OSABI, 0);
+ _elfHeader->e_version(1);
} else {
// override the contents of the ELF Header
- _targetHandler.setHeaderInfo(_Header.get());
+ _targetHandler.setELFHeader(_elfHeader.get());
}
- _Header->e_phoff(_programHeader->fileOffset());
- _Header->e_shoff(_shdrtab->fileOffset());
- _Header->e_phentsize(_programHeader->entsize());
- _Header->e_phnum(_programHeader->numHeaders());
- _Header->e_shentsize(_shdrtab->entsize());
- _Header->e_shnum(_shdrtab->numHeaders());
- _Header->e_shstrndx(_shstrtab->ordinal());
+ _elfHeader->e_phoff(_programHeader->fileOffset());
+ _elfHeader->e_shoff(_shdrtab->fileOffset());
+ _elfHeader->e_phentsize(_programHeader->entsize());
+ _elfHeader->e_phnum(_programHeader->numHeaders());
+ _elfHeader->e_shentsize(_shdrtab->entsize());
+ _elfHeader->e_shnum(_shdrtab->numHeaders());
+ _elfHeader->e_shstrndx(_shstrtab->ordinal());
uint64_t virtualAddr = 0;
_layout->findAtomAddrByName(_context.entrySymbolName(), virtualAddr);
- _Header->e_entry(virtualAddr);
+ _elfHeader->e_entry(virtualAddr);
// HACK: We have to write out the header and program header here even though
// they are a member of a segment because only sections are written in the
// following loop.
ScopedTask writeTask(getDefaultDomain(), "ELF Writer write to memory");
- _Header->write(this, *buffer);
+ _elfHeader->write(this, *buffer);
_programHeader->write(this, *buffer);
for (auto section : _layout->sections())
Modified: lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h?rev=189209&r1=189208&r2=189209&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SectionChunks.h Sun Aug 25 22:16:13 2013
@@ -48,7 +48,7 @@ template <class ELFT> class Segment;
template <class ELFT> class Section : public Chunk<ELFT> {
public:
Section(const ELFLinkingContext &context, StringRef name,
- typename Chunk<ELFT>::Kind k = Chunk<ELFT>::K_ELFSection)
+ typename Chunk<ELFT>::Kind k = Chunk<ELFT>::Kind::ELFSection)
: Chunk<ELFT>(name, k, context), _parent(nullptr), _flags(0), _entSize(0),
_type(0), _link(0), _info(0), _segmentType(SHT_NULL) {}
@@ -81,13 +81,13 @@ public:
/// \brief Return the type of content that the section contains
virtual int getContentType() const {
if (_flags & llvm::ELF::SHF_EXECINSTR)
- return Chunk<ELFT>::CT_Code;
+ return Chunk<ELFT>::ContentType::Code;
else if (_flags & llvm::ELF::SHF_WRITE)
- return Chunk<ELFT>::CT_Data;
+ return Chunk<ELFT>::ContentType::Data;
else if (_flags & llvm::ELF::SHF_ALLOC)
- return Chunk<ELFT>::CT_Code;
+ return Chunk<ELFT>::ContentType::Code;
else
- return Chunk<ELFT>::CT_Unknown;
+ return Chunk<ELFT>::ContentType::Unknown;
}
/// \brief convert the segment type to a String for diagnostics and printing
@@ -109,8 +109,8 @@ public:
}
static bool classof(const Chunk<ELFT> *c) {
- return c->kind() == Chunk<ELFT>::K_ELFSection ||
- c->kind() == Chunk<ELFT>::K_AtomSection;
+ return c->kind() == Chunk<ELFT>::Kind::ELFSection ||
+ c->kind() == Chunk<ELFT>::Kind::AtomSection;
}
protected:
@@ -135,7 +135,7 @@ template <class ELFT> class AtomSection
public:
AtomSection(const ELFLinkingContext &context, StringRef name,
int32_t contentType, int32_t permissions, int32_t order)
- : Section<ELFT>(context, name, Chunk<ELFT>::K_AtomSection),
+ : Section<ELFT>(context, name, Chunk<ELFT>::Kind::AtomSection),
_contentType(contentType), _contentPermissions(permissions) {
this->setOrder(order);
switch (contentType) {
@@ -215,18 +215,6 @@ public:
return false;
}
- /// \brief Does the Atom occupy any disk space
- bool occupiesNoDiskSpace() const {
- return ((_contentType == DefinedAtom::typeZeroFill) ||
- (_contentType == DefinedAtom::typeZeroFillFast));
- }
-
- /// \brief The permission of the section is the most permissive permission
- /// of all atoms that the section contains
- void setContentPermissions(int32_t perm) {
- _contentPermissions = std::max(perm, _contentPermissions);
- }
-
/// \brief Return the raw flags, we need this to sort segments
inline int64_t atomflags() const {
return _contentPermissions;
@@ -240,7 +228,7 @@ public:
virtual void write(ELFWriter *writer, llvm::FileOutputBuffer &buffer);
static bool classof(const Chunk<ELFT> *c) {
- return c->kind() == Chunk<ELFT>::K_AtomSection;
+ return c->kind() == Chunk<ELFT>::Kind::AtomSection;
}
protected:
Modified: lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h?rev=189209&r1=189208&r2=189209&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/SegmentChunks.h Sun Aug 25 22:16:13 2013
@@ -192,7 +192,7 @@ public:
// For LLVM RTTI
static inline bool classof(const Chunk<ELFT> *c) {
- return c->kind() == Chunk<ELFT>::K_ELFSegment;
+ return c->kind() == Chunk<ELFT>::Kind::ELFSegment;
}
// Getters
@@ -212,16 +212,16 @@ public:
switch (_segmentType) {
case llvm::ELF::PT_LOAD: {
if (fl && llvm::ELF::PF_X)
- return Chunk<ELFT>::CT_Code;
+ return Chunk<ELFT>::ContentType::Code;
if (fl && llvm::ELF::PF_W)
- return Chunk<ELFT>::CT_Data;
+ return Chunk<ELFT>::ContentType::Data;
}
case llvm::ELF::PT_TLS:
- return Chunk<ELFT>::CT_Tls;
+ return Chunk<ELFT>::ContentType::TLS;
case llvm::ELF::PT_NOTE:
- return Chunk<ELFT>::CT_Note;
+ return Chunk<ELFT>::ContentType::Note;
default:
- return Chunk<ELFT>::CT_Unknown;
+ return Chunk<ELFT>::ContentType::Unknown;
}
}
@@ -274,7 +274,7 @@ private:
/// \brief Check if the chunk needs to be aligned
bool needAlign(Chunk<ELFT> *chunk) const {
- if (chunk->getContentType() == Chunk<ELFT>::CT_Data &&
+ if (chunk->getContentType() == Chunk<ELFT>::ContentType::Data &&
_outputMagic == ELFLinkingContext::OutputMagic::NMAGIC)
return true;
return false;
@@ -327,8 +327,8 @@ protected:
template <class ELFT>
Segment<ELFT>::Segment(const ELFLinkingContext &context, StringRef name,
const Layout::SegmentType type)
- : Chunk<ELFT>(name, Chunk<ELFT>::K_ELFSegment, context), _segmentType(type),
- _flags(0), _atomflags(0) {
+ : Chunk<ELFT>(name, Chunk<ELFT>::Kind::ELFSegment, context),
+ _segmentType(type), _flags(0), _atomflags(0) {
this->_align2 = 0;
this->_fsize = 0;
_outputMagic = context.getOutputMagic();
Modified: lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h?rev=189209&r1=189208&r2=189209&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/TargetHandler.h Sun Aug 25 22:16:13 2013
@@ -34,7 +34,7 @@ namespace elf {
template <class ELFT> class ELFDefinedAtom;
template <class ELFT> class ELFReference;
class ELFWriter;
-template <class ELFT> class Header;
+template <class ELFT> class ELFHeader;
template <class ELFT> class Section;
template <class ELFT> class TargetLayout;
@@ -89,10 +89,10 @@ public:
/// If the target overrides ELF header information, this API would
/// return true, so that the target can set all fields specific to
/// that target
- virtual bool doesOverrideHeader() = 0;
+ virtual bool doesOverrideELFHeader() = 0;
/// Set the ELF Header information
- virtual void setHeaderInfo(Header<ELFT> *Header) = 0;
+ virtual void setELFHeader(ELFHeader<ELFT> *elfHeader) = 0;
/// TargetLayout
virtual TargetLayout<ELFT> &targetLayout() = 0;
More information about the llvm-commits
mailing list