summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/HeaderChunks.h
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/HeaderChunks.h')
-rw-r--r--lld/lib/ReaderWriter/ELF/HeaderChunks.h33
1 files changed, 13 insertions, 20 deletions
diff --git a/lld/lib/ReaderWriter/ELF/HeaderChunks.h b/lld/lib/ReaderWriter/ELF/HeaderChunks.h
index dcdef448999..495ca35cb87 100644
--- a/lld/lib/ReaderWriter/ELF/HeaderChunks.h
+++ b/lld/lib/ReaderWriter/ELF/HeaderChunks.h
@@ -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 ELFLinkingContext &context)
}
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);
OpenPOWER on IntegriCloud