diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 9174e81857e4..3ec498ec2110 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -34,8 +34,7 @@ OutputSectionBase::OutputSectionBase(StringRef Name, uint32_t sh_type, template GotPltSection::GotPltSection() - : OutputSectionBase(".got.plt", llvm::ELF::SHT_PROGBITS, - llvm::ELF::SHF_ALLOC | llvm::ELF::SHF_WRITE) { + : OutputSectionBase(".got.plt", SHT_PROGBITS, SHF_ALLOC | SHF_WRITE) { this->Header.sh_addralign = sizeof(uintX_t); } @@ -70,10 +69,9 @@ template void GotPltSection::writeTo(uint8_t *Buf) { template GotSection::GotSection() - : OutputSectionBase(".got", llvm::ELF::SHT_PROGBITS, - llvm::ELF::SHF_ALLOC | llvm::ELF::SHF_WRITE) { + : OutputSectionBase(".got", SHT_PROGBITS, SHF_ALLOC | SHF_WRITE) { if (Config->EMachine == EM_MIPS) - this->Header.sh_flags |= llvm::ELF::SHF_MIPS_GPREL; + this->Header.sh_flags |= SHF_MIPS_GPREL; this->Header.sh_addralign = sizeof(uintX_t); } @@ -151,8 +149,7 @@ template void GotSection::writeTo(uint8_t *Buf) { template PltSection::PltSection() - : OutputSectionBase(".plt", llvm::ELF::SHT_PROGBITS, - llvm::ELF::SHF_ALLOC | llvm::ELF::SHF_EXECINSTR) { + : OutputSectionBase(".plt", SHT_PROGBITS, SHF_ALLOC | SHF_EXECINSTR) { this->Header.sh_addralign = 16; } @@ -199,9 +196,7 @@ template void PltSection::finalize() { template RelocationSection::RelocationSection(StringRef Name, bool IsRela) - : OutputSectionBase(Name, - IsRela ? llvm::ELF::SHT_RELA : llvm::ELF::SHT_REL, - llvm::ELF::SHF_ALLOC), + : OutputSectionBase(Name, IsRela ? SHT_RELA : SHT_REL, SHF_ALLOC), IsRela(IsRela) { this->Header.sh_entsize = IsRela ? sizeof(Elf_Rela) : sizeof(Elf_Rel); this->Header.sh_addralign = ELFT::Is64Bits ? 8 : 4; @@ -328,8 +323,7 @@ template void RelocationSection::finalize() { template InterpSection::InterpSection() - : OutputSectionBase(".interp", llvm::ELF::SHT_PROGBITS, - llvm::ELF::SHF_ALLOC) { + : OutputSectionBase(".interp", SHT_PROGBITS, SHF_ALLOC) { this->Header.sh_size = Config->DynamicLinker.size() + 1; this->Header.sh_addralign = 1; } @@ -346,8 +340,7 @@ template void InterpSection::writeTo(uint8_t *Buf) { template HashTableSection::HashTableSection() - : OutputSectionBase(".hash", llvm::ELF::SHT_HASH, - llvm::ELF::SHF_ALLOC) { + : OutputSectionBase(".hash", SHT_HASH, SHF_ALLOC) { this->Header.sh_entsize = sizeof(Elf_Word); this->Header.sh_addralign = sizeof(Elf_Word); } @@ -404,8 +397,7 @@ static uint32_t hashGnu(StringRef Name) { template GnuHashTableSection::GnuHashTableSection() - : OutputSectionBase(".gnu.hash", llvm::ELF::SHT_GNU_HASH, - llvm::ELF::SHF_ALLOC) { + : OutputSectionBase(".gnu.hash", SHT_GNU_HASH, SHF_ALLOC) { this->Header.sh_entsize = ELFT::Is64Bits ? 0 : 4; this->Header.sh_addralign = ELFT::Is64Bits ? 8 : 4; } @@ -545,8 +537,7 @@ void GnuHashTableSection::addSymbols(std::vector &Symbols) { template DynamicSection::DynamicSection(SymbolTable &SymTab) - : OutputSectionBase(".dynamic", llvm::ELF::SHT_DYNAMIC, - llvm::ELF::SHF_ALLOC | llvm::ELF::SHF_WRITE), + : OutputSectionBase(".dynamic", SHT_DYNAMIC, SHF_ALLOC | SHF_WRITE), SymTab(SymTab) { Elf_Shdr &Header = this->Header; Header.sh_addralign = ELFT::Is64Bits ? 8 : 4; @@ -556,7 +547,7 @@ DynamicSection::DynamicSection(SymbolTable &SymTab) // See "Special Section" in Chapter 4 in the following document: // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf if (Config->EMachine == EM_MIPS) - Header.sh_flags = llvm::ELF::SHF_ALLOC; + Header.sh_flags = SHF_ALLOC; } template void DynamicSection::finalize() { @@ -1165,8 +1156,8 @@ template void MergeOutputSection::finalize() { template StringTableSection::StringTableSection(StringRef Name, bool Dynamic) - : OutputSectionBase(Name, llvm::ELF::SHT_STRTAB, - Dynamic ? (uintX_t)llvm::ELF::SHF_ALLOC : 0), + : OutputSectionBase(Name, SHT_STRTAB, + Dynamic ? (uintX_t)SHF_ALLOC : 0), Dynamic(Dynamic) { this->Header.sh_addralign = 1; } @@ -1207,10 +1198,9 @@ bool elf2::shouldKeepInSymtab(const ObjectFile &File, StringRef SymName, template SymbolTableSection::SymbolTableSection( SymbolTable &Table, StringTableSection &StrTabSec) - : OutputSectionBase( - StrTabSec.isDynamic() ? ".dynsym" : ".symtab", - StrTabSec.isDynamic() ? llvm::ELF::SHT_DYNSYM : llvm::ELF::SHT_SYMTAB, - StrTabSec.isDynamic() ? (uintX_t)llvm::ELF::SHF_ALLOC : 0), + : OutputSectionBase(StrTabSec.isDynamic() ? ".dynsym" : ".symtab", + StrTabSec.isDynamic() ? SHT_DYNSYM : SHT_SYMTAB, + StrTabSec.isDynamic() ? (uintX_t)SHF_ALLOC : 0), Table(Table), StrTabSec(StrTabSec) { typedef OutputSectionBase Base; typename Base::Elf_Shdr &Header = this->Header;