diff options
-rw-r--r-- | lld/ELF/Config.h | 5 | ||||
-rw-r--r-- | lld/ELF/Driver.cpp | 6 | ||||
-rw-r--r-- | lld/ELF/InputSection.cpp | 4 | ||||
-rw-r--r-- | lld/ELF/SyntheticSections.cpp | 2 |
4 files changed, 10 insertions, 7 deletions
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index 084d58a32a3..0bb46c3fec3 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -173,7 +173,10 @@ struct Configuration { // output file. Usually false because we consume relocations. bool CopyRelocs; - // True if the target is little-endian. False if the target is big-endian. + // True if the target is ELF64. False if ELF32. + bool Is64; + + // True if the target is little-endian. False if big-endian. bool IsLE; // endianness::little if IsLE is true. endianness::big otherwise. diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 128b2ee20ac..d2c8f338fa3 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -707,20 +707,20 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) { static void setConfigs() { ELFKind Kind = Config->EKind; uint16_t Machine = Config->EMachine; - bool Is64 = (Kind == ELF64LEKind || Kind == ELF64BEKind); // There is an ILP32 ABI for x86-64, although it's not very popular. // It is called the x32 ABI. bool IsX32 = (Kind == ELF32LEKind && Machine == EM_X86_64); Config->CopyRelocs = (Config->Relocatable || Config->EmitRelocs); + Config->Is64 = (Kind == ELF64LEKind || Kind == ELF64BEKind); Config->IsLE = (Kind == ELF32LEKind || Kind == ELF64LEKind); Config->Endianness = Config->IsLE ? support::endianness::little : support::endianness::big; Config->IsMips64EL = (Kind == ELF64LEKind && Machine == EM_MIPS); - Config->IsRela = Is64 || IsX32 || Config->MipsN32Abi; + Config->IsRela = Config->Is64 || IsX32 || Config->MipsN32Abi; Config->Pic = Config->Pie || Config->Shared; - Config->Wordsize = Is64 ? 8 : 4; + Config->Wordsize = Config->Is64 ? 8 : 4; } // Returns a value of "-format" option. diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index c8746a9f66a..92b2e572a89 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -140,8 +140,8 @@ OutputSection *SectionBase::getOutputSection() { // Uncompress section contents. Note that this function is called // from parallel_for_each, so it must be thread-safe. void InputSectionBase::uncompress() { - Decompressor Dec = check(Decompressor::create( - Name, toStringRef(Data), Config->IsLE, Config->Wordsize == 8)); + Decompressor Dec = check(Decompressor::create(Name, toStringRef(Data), + Config->IsLE, Config->Is64)); size_t Size = Dec.getDecompressedSize(); char *OutputBuf; diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 08af575a374..c98f152e29f 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -846,7 +846,7 @@ uint64_t MipsGotSection::getGp() const { } static void writeUint(uint8_t *Buf, uint64_t Val) { - if (Config->Wordsize == 8) + if (Config->Is64) write64(Buf, Val, Config->Endianness); else write32(Buf, Val, Config->Endianness); |