[ELF] Replace noneRel = R_*_NONE with static constexpr. NFC

All architectures define R_*_NONE to 0.
This commit is contained in:
Fangrui Song 2021-09-25 15:16:44 -07:00
parent 40cd4db442
commit d23fd8ae89
13 changed files with 1 additions and 15 deletions

View File

@ -62,7 +62,6 @@ AArch64::AArch64() {
relativeRel = R_AARCH64_RELATIVE;
iRelativeRel = R_AARCH64_IRELATIVE;
gotRel = R_AARCH64_GLOB_DAT;
noneRel = R_AARCH64_NONE;
pltRel = R_AARCH64_JUMP_SLOT;
symbolicRel = R_AARCH64_ABS64;
tlsDescRel = R_AARCH64_TLSDESC;

View File

@ -40,7 +40,6 @@ public:
AMDGPU::AMDGPU() {
relativeRel = R_AMDGPU_RELATIVE64;
gotRel = R_AMDGPU_ABS64;
noneRel = R_AMDGPU_NONE;
symbolicRel = R_AMDGPU_ABS64;
}

View File

@ -52,7 +52,6 @@ ARM::ARM() {
relativeRel = R_ARM_RELATIVE;
iRelativeRel = R_ARM_IRELATIVE;
gotRel = R_ARM_GLOB_DAT;
noneRel = R_ARM_NONE;
pltRel = R_ARM_JUMP_SLOT;
symbolicRel = R_ARM_ABS32;
tlsGotRel = R_ARM_TLS_TPOFF32;

View File

@ -42,7 +42,6 @@ using namespace lld::elf;
namespace {
class AVR final : public TargetInfo {
public:
AVR();
uint32_t calcEFlags() const override;
RelExpr getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const override;
@ -51,8 +50,6 @@ public:
};
} // namespace
AVR::AVR() { noneRel = R_AVR_NONE; }
RelExpr AVR::getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const {
switch (type) {

View File

@ -54,7 +54,6 @@ Hexagon::Hexagon() {
// Hexagon Linux uses 64K pages by default.
defaultMaxPageSize = 0x10000;
noneRel = R_HEX_NONE;
tlsGotRel = R_HEX_TPREL_32;
tlsModuleIndexRel = R_HEX_DTPMOD_32;
tlsOffsetRel = R_HEX_DTPREL_32;

View File

@ -49,7 +49,6 @@ template <class ELFT> MIPS<ELFT>::MIPS() {
pltEntrySize = 16;
pltHeaderSize = 32;
copyRel = R_MIPS_COPY;
noneRel = R_MIPS_NONE;
pltRel = R_MIPS_JUMP_SLOT;
needsThunks = true;

View File

@ -151,7 +151,6 @@ void elf::writePPC32GlinkSection(uint8_t *buf, size_t numEntries) {
PPC::PPC() {
copyRel = R_PPC_COPY;
gotRel = R_PPC_GLOB_DAT;
noneRel = R_PPC_NONE;
pltRel = R_PPC_JMP_SLOT;
relativeRel = R_PPC_RELATIVE;
iRelativeRel = R_PPC_IRELATIVE;

View File

@ -568,7 +568,6 @@ static uint64_t readPrefixedInstruction(const uint8_t *loc) {
PPC64::PPC64() {
copyRel = R_PPC64_COPY;
gotRel = R_PPC64_GLOB_DAT;
noneRel = R_PPC64_NONE;
pltRel = R_PPC64_JMP_SLOT;
relativeRel = R_PPC64_RELATIVE;
iRelativeRel = R_PPC64_IRELATIVE;

View File

@ -75,7 +75,6 @@ static uint32_t utype(uint32_t op, uint32_t rd, uint32_t imm) {
RISCV::RISCV() {
copyRel = R_RISCV_COPY;
noneRel = R_RISCV_NONE;
pltRel = R_RISCV_JUMP_SLOT;
relativeRel = R_RISCV_RELATIVE;
iRelativeRel = R_RISCV_IRELATIVE;

View File

@ -35,7 +35,6 @@ public:
SPARCV9::SPARCV9() {
copyRel = R_SPARC_COPY;
gotRel = R_SPARC_GLOB_DAT;
noneRel = R_SPARC_NONE;
pltRel = R_SPARC_JMP_SLOT;
relativeRel = R_SPARC_RELATIVE;
symbolicRel = R_SPARC_64;

View File

@ -52,7 +52,6 @@ public:
X86::X86() {
copyRel = R_386_COPY;
gotRel = R_386_GLOB_DAT;
noneRel = R_386_NONE;
pltRel = R_386_JUMP_SLOT;
iRelativeRel = R_386_IRELATIVE;
relativeRel = R_386_RELATIVE;

View File

@ -78,7 +78,6 @@ static const std::vector<std::vector<uint8_t>> nopInstructions = {
X86_64::X86_64() {
copyRel = R_X86_64_COPY;
gotRel = R_X86_64_GLOB_DAT;
noneRel = R_X86_64_NONE;
pltRel = R_X86_64_JUMP_SLOT;
relativeRel = R_X86_64_RELATIVE;
iRelativeRel = R_X86_64_IRELATIVE;

View File

@ -111,9 +111,9 @@ public:
// True if _GLOBAL_OFFSET_TABLE_ is relative to .got.plt, false if .got.
bool gotBaseSymInGotPlt = false;
static constexpr RelType noneRel = 0;
RelType copyRel;
RelType gotRel;
RelType noneRel;
RelType pltRel;
RelType relativeRel;
RelType iRelativeRel;