Skip to content

Commit

Permalink
[ELF] Replace noneRel = R_*_NONE with static constexpr. NFC
Browse files Browse the repository at this point in the history
All architectures define R_*_NONE to 0.
  • Loading branch information
MaskRay committed Sep 25, 2021
1 parent 40cd4db commit d23fd8a
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 15 deletions.
1 change: 0 additions & 1 deletion lld/ELF/Arch/AArch64.cpp
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion lld/ELF/Arch/AMDGPU.cpp
Expand Up @@ -40,7 +40,6 @@ class AMDGPU final : public TargetInfo {
AMDGPU::AMDGPU() {
relativeRel = R_AMDGPU_RELATIVE64;
gotRel = R_AMDGPU_ABS64;
noneRel = R_AMDGPU_NONE;
symbolicRel = R_AMDGPU_ABS64;
}

Expand Down
1 change: 0 additions & 1 deletion lld/ELF/Arch/ARM.cpp
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions lld/ELF/Arch/AVR.cpp
Expand Up @@ -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;
Expand All @@ -51,8 +50,6 @@ class AVR final : public TargetInfo {
};
} // namespace

AVR::AVR() { noneRel = R_AVR_NONE; }

RelExpr AVR::getRelExpr(RelType type, const Symbol &s,
const uint8_t *loc) const {
switch (type) {
Expand Down
1 change: 0 additions & 1 deletion lld/ELF/Arch/Hexagon.cpp
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion lld/ELF/Arch/Mips.cpp
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion lld/ELF/Arch/PPC.cpp
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion lld/ELF/Arch/PPC64.cpp
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion lld/ELF/Arch/RISCV.cpp
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion lld/ELF/Arch/SPARCV9.cpp
Expand Up @@ -35,7 +35,6 @@ class SPARCV9 final : public TargetInfo {
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;
Expand Down
1 change: 0 additions & 1 deletion lld/ELF/Arch/X86.cpp
Expand Up @@ -52,7 +52,6 @@ class X86 : public TargetInfo {
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;
Expand Down
1 change: 0 additions & 1 deletion lld/ELF/Arch/X86_64.cpp
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lld/ELF/Target.h
Expand Up @@ -111,9 +111,9 @@ class TargetInfo {
// 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;
Expand Down

0 comments on commit d23fd8a

Please sign in to comment.