diff options
author | Simon Atanasyan <simon@atanasyan.com> | 2019-07-24 11:37:13 +0000 |
---|---|---|
committer | Simon Atanasyan <simon@atanasyan.com> | 2019-07-24 11:37:13 +0000 |
commit | 5adbfdda2db97811e5e8f34a86d730d90e25ca15 (patch) | |
tree | 62ad183226ee7824066ddad91e58ff1331c0aa79 | |
parent | 3daefb07448ae14ce7a4141b21cfe6ed1242e244 (diff) | |
download | bcm5719-llvm-5adbfdda2db97811e5e8f34a86d730d90e25ca15.tar.gz bcm5719-llvm-5adbfdda2db97811e5e8f34a86d730d90e25ca15.zip |
[mips] Assign R_TLS type to the R_MIPS_TLS_TPREL_XXX relocations. NFC
That allows to remove duplicated code which subtracts 0x7000 from the
R_MIPS_TLS_TPREL_XXX relocations values in the `MIPS::relocateOne`
function.
llvm-svn: 366888
-rw-r--r-- | lld/ELF/Arch/Mips.cpp | 12 | ||||
-rw-r--r-- | lld/ELF/InputSection.cpp | 1 |
2 files changed, 5 insertions, 8 deletions
diff --git a/lld/ELF/Arch/Mips.cpp b/lld/ELF/Arch/Mips.cpp index 24b3957acd9..d218cf224d4 100644 --- a/lld/ELF/Arch/Mips.cpp +++ b/lld/ELF/Arch/Mips.cpp @@ -120,15 +120,16 @@ RelExpr MIPS<ELFT>::getRelExpr(RelType type, const Symbol &s, case R_MIPS_TLS_DTPREL_LO16: case R_MIPS_TLS_DTPREL32: case R_MIPS_TLS_DTPREL64: + case R_MICROMIPS_TLS_DTPREL_HI16: + case R_MICROMIPS_TLS_DTPREL_LO16: + return R_ABS; case R_MIPS_TLS_TPREL_HI16: case R_MIPS_TLS_TPREL_LO16: case R_MIPS_TLS_TPREL32: case R_MIPS_TLS_TPREL64: - case R_MICROMIPS_TLS_DTPREL_HI16: - case R_MICROMIPS_TLS_DTPREL_LO16: case R_MICROMIPS_TLS_TPREL_HI16: case R_MICROMIPS_TLS_TPREL_LO16: - return R_ABS; + return R_TLS; case R_MIPS_PC32: case R_MIPS_PC16: case R_MIPS_PC19_S2: @@ -538,11 +539,6 @@ void MIPS<ELFT>::relocateOne(uint8_t *loc, RelType type, uint64_t val) const { type == R_MICROMIPS_TLS_DTPREL_HI16 || type == R_MICROMIPS_TLS_DTPREL_LO16) { val -= 0x8000; - } else if (type == R_MIPS_TLS_TPREL_HI16 || type == R_MIPS_TLS_TPREL_LO16 || - type == R_MIPS_TLS_TPREL32 || type == R_MIPS_TLS_TPREL64 || - type == R_MICROMIPS_TLS_TPREL_HI16 || - type == R_MICROMIPS_TLS_TPREL_LO16) { - val -= 0x7000; } switch (type) { diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index a024ac307b0..c9a02c91c84 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -619,6 +619,7 @@ static int64_t getTlsTpOffset(const Symbol &s) { case EM_X86_64: // Variant 2. The TLS segment is located just before the thread pointer. return s.getVA(0) - alignTo(Out::tlsPhdr->p_memsz, Out::tlsPhdr->p_align); + case EM_MIPS: case EM_PPC: case EM_PPC64: // The thread pointer points to a fixed offset from the start of the |