[lld] r298463 - Define Config::Is64.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 21 17:01:11 PDT 2017
Author: ruiu
Date: Tue Mar 21 19:01:11 2017
New Revision: 298463
URL: http://llvm.org/viewvc/llvm-project?rev=298463&view=rev
Log:
Define Config::Is64.
This is a shorthand for Config->Wordsize == 8. So this is not strictly
necessary but seems handy. "Is 64 bit?" is easier to read than "Is
wordsize 8 byte?"
Modified:
lld/trunk/ELF/Config.h
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/InputSection.cpp
lld/trunk/ELF/SyntheticSections.cpp
Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=298463&r1=298462&r2=298463&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Tue Mar 21 19:01:11 2017
@@ -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.
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=298463&r1=298462&r2=298463&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Mar 21 19:01:11 2017
@@ -707,20 +707,20 @@ void LinkerDriver::readConfigs(opt::Inpu
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.
Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=298463&r1=298462&r2=298463&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Tue Mar 21 19:01:11 2017
@@ -140,8 +140,8 @@ OutputSection *SectionBase::getOutputSec
// 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;
Modified: lld/trunk/ELF/SyntheticSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SyntheticSections.cpp?rev=298463&r1=298462&r2=298463&view=diff
==============================================================================
--- lld/trunk/ELF/SyntheticSections.cpp (original)
+++ lld/trunk/ELF/SyntheticSections.cpp Tue Mar 21 19:01:11 2017
@@ -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);
More information about the llvm-commits
mailing list