diff options
| author | Fangrui Song <maskray@google.com> | 2019-08-16 17:01:56 +0000 |
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2019-08-16 17:01:56 +0000 |
| commit | 7ca1e0c825e6242148d14e9f5f727c98a3f3fd11 (patch) | |
| tree | 0213e5a2f47d6fe46268a18194da9d5cd5b02001 | |
| parent | 144903310f58756b84144311762be1b5e0a3eec7 (diff) | |
| download | bcm5719-llvm-7ca1e0c825e6242148d14e9f5f727c98a3f3fd11.tar.gz bcm5719-llvm-7ca1e0c825e6242148d14e9f5f727c98a3f3fd11.zip | |
[ELF][Hexagon] Replace R_HEXAGON_GOT with R_GOTPLT
R_GOTPLT is relative to .got.plt since D59594. Since R_HEXAGON_GOT
relocations always have 0 r_addend, they can use R_GOTPLT instead.
Reviewed By: sidneym
Differential Revision: https://reviews.llvm.org/D66274
llvm-svn: 369128
| -rw-r--r-- | lld/ELF/Arch/Hexagon.cpp | 2 | ||||
| -rw-r--r-- | lld/ELF/InputSection.cpp | 2 | ||||
| -rw-r--r-- | lld/ELF/Relocations.cpp | 8 | ||||
| -rw-r--r-- | lld/ELF/Relocations.h | 1 |
4 files changed, 5 insertions, 8 deletions
diff --git a/lld/ELF/Arch/Hexagon.cpp b/lld/ELF/Arch/Hexagon.cpp index f4268c0e406..e805b550a11 100644 --- a/lld/ELF/Arch/Hexagon.cpp +++ b/lld/ELF/Arch/Hexagon.cpp @@ -103,7 +103,7 @@ RelExpr Hexagon::getRelExpr(RelType type, const Symbol &s, case R_HEX_GOT_11_X: case R_HEX_GOT_16_X: case R_HEX_GOT_32_6_X: - return R_HEXAGON_GOT; + return R_GOTPLT; default: return R_ABS; } diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index c9a02c91c84..e8a821bd33b 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -672,8 +672,6 @@ static uint64_t getRelocTargetVA(const InputFile *file, RelType type, int64_t a, case R_GOT_PC: case R_RELAX_TLS_GD_TO_IE: return sym.getGotVA() + a - p; - case R_HEXAGON_GOT: - return sym.getGotVA() - in.gotPlt->getVA(); case R_MIPS_GOTREL: return sym.getVA(a) - in.mipsGot->getGp(file); case R_MIPS_GOT_GP: diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index d611acb000c..bb629a0c5c0 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -344,9 +344,9 @@ static bool needsPlt(RelExpr expr) { // returns false for TLS variables even though they need GOT, because // TLS variables uses GOT differently than the regular variables. static bool needsGot(RelExpr expr) { - return oneof<R_GOT, R_GOT_OFF, R_HEXAGON_GOT, R_MIPS_GOT_LOCAL_PAGE, - R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32, R_AARCH64_GOT_PAGE_PC, - R_GOT_PC, R_GOTPLT>(expr); + return oneof<R_GOT, R_GOT_OFF, R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOT_OFF, + R_MIPS_GOT_OFF32, R_AARCH64_GOT_PAGE_PC, R_GOT_PC, R_GOTPLT>( + expr); } // True if this expression is of the form Sym - X, where X is a position in the @@ -369,7 +369,7 @@ static bool isRelExpr(RelExpr expr) { static bool isStaticLinkTimeConstant(RelExpr e, RelType type, const Symbol &sym, InputSectionBase &s, uint64_t relOff) { // These expressions always compute a constant - if (oneof<R_DTPREL, R_GOTPLT, R_GOT_OFF, R_HEXAGON_GOT, R_TLSLD_GOT_OFF, + if (oneof<R_DTPREL, R_GOTPLT, R_GOT_OFF, R_TLSLD_GOT_OFF, R_MIPS_GOT_LOCAL_PAGE, R_MIPS_GOTREL, R_MIPS_GOT_OFF, R_MIPS_GOT_OFF32, R_MIPS_GOT_GP_PC, R_MIPS_TLSGD, R_AARCH64_GOT_PAGE_PC, R_GOT_PC, R_GOTONLY_PC, R_GOTPLTONLY_PC, diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h index d74d7b9b458..befe15b8f3b 100644 --- a/lld/ELF/Relocations.h +++ b/lld/ELF/Relocations.h @@ -82,7 +82,6 @@ enum RelExpr { R_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC, R_AARCH64_TLSDESC_PAGE, R_ARM_SBREL, - R_HEXAGON_GOT, R_MIPS_GOTREL, R_MIPS_GOT_GP, R_MIPS_GOT_GP_PC, |

