[ELF] Replace noneRel = R_*_NONE with static constexpr. NFC
All architectures define R_*_NONE to 0.
This commit is contained in:
parent
40cd4db442
commit
d23fd8ae89
|
@ -62,7 +62,6 @@ AArch64::AArch64() {
|
||||||
relativeRel = R_AARCH64_RELATIVE;
|
relativeRel = R_AARCH64_RELATIVE;
|
||||||
iRelativeRel = R_AARCH64_IRELATIVE;
|
iRelativeRel = R_AARCH64_IRELATIVE;
|
||||||
gotRel = R_AARCH64_GLOB_DAT;
|
gotRel = R_AARCH64_GLOB_DAT;
|
||||||
noneRel = R_AARCH64_NONE;
|
|
||||||
pltRel = R_AARCH64_JUMP_SLOT;
|
pltRel = R_AARCH64_JUMP_SLOT;
|
||||||
symbolicRel = R_AARCH64_ABS64;
|
symbolicRel = R_AARCH64_ABS64;
|
||||||
tlsDescRel = R_AARCH64_TLSDESC;
|
tlsDescRel = R_AARCH64_TLSDESC;
|
||||||
|
|
|
@ -40,7 +40,6 @@ public:
|
||||||
AMDGPU::AMDGPU() {
|
AMDGPU::AMDGPU() {
|
||||||
relativeRel = R_AMDGPU_RELATIVE64;
|
relativeRel = R_AMDGPU_RELATIVE64;
|
||||||
gotRel = R_AMDGPU_ABS64;
|
gotRel = R_AMDGPU_ABS64;
|
||||||
noneRel = R_AMDGPU_NONE;
|
|
||||||
symbolicRel = R_AMDGPU_ABS64;
|
symbolicRel = R_AMDGPU_ABS64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ ARM::ARM() {
|
||||||
relativeRel = R_ARM_RELATIVE;
|
relativeRel = R_ARM_RELATIVE;
|
||||||
iRelativeRel = R_ARM_IRELATIVE;
|
iRelativeRel = R_ARM_IRELATIVE;
|
||||||
gotRel = R_ARM_GLOB_DAT;
|
gotRel = R_ARM_GLOB_DAT;
|
||||||
noneRel = R_ARM_NONE;
|
|
||||||
pltRel = R_ARM_JUMP_SLOT;
|
pltRel = R_ARM_JUMP_SLOT;
|
||||||
symbolicRel = R_ARM_ABS32;
|
symbolicRel = R_ARM_ABS32;
|
||||||
tlsGotRel = R_ARM_TLS_TPOFF32;
|
tlsGotRel = R_ARM_TLS_TPOFF32;
|
||||||
|
|
|
@ -42,7 +42,6 @@ using namespace lld::elf;
|
||||||
namespace {
|
namespace {
|
||||||
class AVR final : public TargetInfo {
|
class AVR final : public TargetInfo {
|
||||||
public:
|
public:
|
||||||
AVR();
|
|
||||||
uint32_t calcEFlags() const override;
|
uint32_t calcEFlags() const override;
|
||||||
RelExpr getRelExpr(RelType type, const Symbol &s,
|
RelExpr getRelExpr(RelType type, const Symbol &s,
|
||||||
const uint8_t *loc) const override;
|
const uint8_t *loc) const override;
|
||||||
|
@ -51,8 +50,6 @@ public:
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
AVR::AVR() { noneRel = R_AVR_NONE; }
|
|
||||||
|
|
||||||
RelExpr AVR::getRelExpr(RelType type, const Symbol &s,
|
RelExpr AVR::getRelExpr(RelType type, const Symbol &s,
|
||||||
const uint8_t *loc) const {
|
const uint8_t *loc) const {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -54,7 +54,6 @@ Hexagon::Hexagon() {
|
||||||
|
|
||||||
// Hexagon Linux uses 64K pages by default.
|
// Hexagon Linux uses 64K pages by default.
|
||||||
defaultMaxPageSize = 0x10000;
|
defaultMaxPageSize = 0x10000;
|
||||||
noneRel = R_HEX_NONE;
|
|
||||||
tlsGotRel = R_HEX_TPREL_32;
|
tlsGotRel = R_HEX_TPREL_32;
|
||||||
tlsModuleIndexRel = R_HEX_DTPMOD_32;
|
tlsModuleIndexRel = R_HEX_DTPMOD_32;
|
||||||
tlsOffsetRel = R_HEX_DTPREL_32;
|
tlsOffsetRel = R_HEX_DTPREL_32;
|
||||||
|
|
|
@ -49,7 +49,6 @@ template <class ELFT> MIPS<ELFT>::MIPS() {
|
||||||
pltEntrySize = 16;
|
pltEntrySize = 16;
|
||||||
pltHeaderSize = 32;
|
pltHeaderSize = 32;
|
||||||
copyRel = R_MIPS_COPY;
|
copyRel = R_MIPS_COPY;
|
||||||
noneRel = R_MIPS_NONE;
|
|
||||||
pltRel = R_MIPS_JUMP_SLOT;
|
pltRel = R_MIPS_JUMP_SLOT;
|
||||||
needsThunks = true;
|
needsThunks = true;
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,6 @@ void elf::writePPC32GlinkSection(uint8_t *buf, size_t numEntries) {
|
||||||
PPC::PPC() {
|
PPC::PPC() {
|
||||||
copyRel = R_PPC_COPY;
|
copyRel = R_PPC_COPY;
|
||||||
gotRel = R_PPC_GLOB_DAT;
|
gotRel = R_PPC_GLOB_DAT;
|
||||||
noneRel = R_PPC_NONE;
|
|
||||||
pltRel = R_PPC_JMP_SLOT;
|
pltRel = R_PPC_JMP_SLOT;
|
||||||
relativeRel = R_PPC_RELATIVE;
|
relativeRel = R_PPC_RELATIVE;
|
||||||
iRelativeRel = R_PPC_IRELATIVE;
|
iRelativeRel = R_PPC_IRELATIVE;
|
||||||
|
|
|
@ -568,7 +568,6 @@ static uint64_t readPrefixedInstruction(const uint8_t *loc) {
|
||||||
PPC64::PPC64() {
|
PPC64::PPC64() {
|
||||||
copyRel = R_PPC64_COPY;
|
copyRel = R_PPC64_COPY;
|
||||||
gotRel = R_PPC64_GLOB_DAT;
|
gotRel = R_PPC64_GLOB_DAT;
|
||||||
noneRel = R_PPC64_NONE;
|
|
||||||
pltRel = R_PPC64_JMP_SLOT;
|
pltRel = R_PPC64_JMP_SLOT;
|
||||||
relativeRel = R_PPC64_RELATIVE;
|
relativeRel = R_PPC64_RELATIVE;
|
||||||
iRelativeRel = R_PPC64_IRELATIVE;
|
iRelativeRel = R_PPC64_IRELATIVE;
|
||||||
|
|
|
@ -75,7 +75,6 @@ static uint32_t utype(uint32_t op, uint32_t rd, uint32_t imm) {
|
||||||
|
|
||||||
RISCV::RISCV() {
|
RISCV::RISCV() {
|
||||||
copyRel = R_RISCV_COPY;
|
copyRel = R_RISCV_COPY;
|
||||||
noneRel = R_RISCV_NONE;
|
|
||||||
pltRel = R_RISCV_JUMP_SLOT;
|
pltRel = R_RISCV_JUMP_SLOT;
|
||||||
relativeRel = R_RISCV_RELATIVE;
|
relativeRel = R_RISCV_RELATIVE;
|
||||||
iRelativeRel = R_RISCV_IRELATIVE;
|
iRelativeRel = R_RISCV_IRELATIVE;
|
||||||
|
|
|
@ -35,7 +35,6 @@ public:
|
||||||
SPARCV9::SPARCV9() {
|
SPARCV9::SPARCV9() {
|
||||||
copyRel = R_SPARC_COPY;
|
copyRel = R_SPARC_COPY;
|
||||||
gotRel = R_SPARC_GLOB_DAT;
|
gotRel = R_SPARC_GLOB_DAT;
|
||||||
noneRel = R_SPARC_NONE;
|
|
||||||
pltRel = R_SPARC_JMP_SLOT;
|
pltRel = R_SPARC_JMP_SLOT;
|
||||||
relativeRel = R_SPARC_RELATIVE;
|
relativeRel = R_SPARC_RELATIVE;
|
||||||
symbolicRel = R_SPARC_64;
|
symbolicRel = R_SPARC_64;
|
||||||
|
|
|
@ -52,7 +52,6 @@ public:
|
||||||
X86::X86() {
|
X86::X86() {
|
||||||
copyRel = R_386_COPY;
|
copyRel = R_386_COPY;
|
||||||
gotRel = R_386_GLOB_DAT;
|
gotRel = R_386_GLOB_DAT;
|
||||||
noneRel = R_386_NONE;
|
|
||||||
pltRel = R_386_JUMP_SLOT;
|
pltRel = R_386_JUMP_SLOT;
|
||||||
iRelativeRel = R_386_IRELATIVE;
|
iRelativeRel = R_386_IRELATIVE;
|
||||||
relativeRel = R_386_RELATIVE;
|
relativeRel = R_386_RELATIVE;
|
||||||
|
|
|
@ -78,7 +78,6 @@ static const std::vector<std::vector<uint8_t>> nopInstructions = {
|
||||||
X86_64::X86_64() {
|
X86_64::X86_64() {
|
||||||
copyRel = R_X86_64_COPY;
|
copyRel = R_X86_64_COPY;
|
||||||
gotRel = R_X86_64_GLOB_DAT;
|
gotRel = R_X86_64_GLOB_DAT;
|
||||||
noneRel = R_X86_64_NONE;
|
|
||||||
pltRel = R_X86_64_JUMP_SLOT;
|
pltRel = R_X86_64_JUMP_SLOT;
|
||||||
relativeRel = R_X86_64_RELATIVE;
|
relativeRel = R_X86_64_RELATIVE;
|
||||||
iRelativeRel = R_X86_64_IRELATIVE;
|
iRelativeRel = R_X86_64_IRELATIVE;
|
||||||
|
|
|
@ -111,9 +111,9 @@ public:
|
||||||
// True if _GLOBAL_OFFSET_TABLE_ is relative to .got.plt, false if .got.
|
// True if _GLOBAL_OFFSET_TABLE_ is relative to .got.plt, false if .got.
|
||||||
bool gotBaseSymInGotPlt = false;
|
bool gotBaseSymInGotPlt = false;
|
||||||
|
|
||||||
|
static constexpr RelType noneRel = 0;
|
||||||
RelType copyRel;
|
RelType copyRel;
|
||||||
RelType gotRel;
|
RelType gotRel;
|
||||||
RelType noneRel;
|
|
||||||
RelType pltRel;
|
RelType pltRel;
|
||||||
RelType relativeRel;
|
RelType relativeRel;
|
||||||
RelType iRelativeRel;
|
RelType iRelativeRel;
|
||||||
|
|
Loading…
Reference in New Issue