diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-04-20 17:20:49 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-04-20 17:20:49 +0000 |
commit | 475dbf42e44152d25474696e8b6df17a47aa0acf (patch) | |
tree | 12990874199b18961d847f781c6af2c43873249d | |
parent | 02d0a635d63c697007f3a1766024d6bcd6966b15 (diff) | |
download | llvm-475dbf42e44152d25474696e8b6df17a47aa0acf.zip llvm-475dbf42e44152d25474696e8b6df17a47aa0acf.tar.gz llvm-475dbf42e44152d25474696e8b6df17a47aa0acf.tar.bz2 |
Simplify mips gp0 handling.
In all currently supported cases this is a nop.
llvm-svn: 266888
-rw-r--r-- | lld/ELF/InputSection.cpp | 5 | ||||
-rw-r--r-- | lld/ELF/InputSection.h | 1 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 6 |
3 files changed, 4 insertions, 8 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 3df6cf00..6b4b803 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -206,11 +206,6 @@ getSymVA(uint32_t Type, typename ELFT::uint A, typename ELFT::uint P, case R_RELAX_TLS_IE_TO_LE: case R_RELAX_TLS_LD_TO_LE: return Body.getVA<ELFT>(A); - case R_MIPS_GP0: - // We need to adjust SymVA value in case of R_MIPS_GPREL16/32 - // relocations because they use the following expression to calculate - // the relocation's result for local symbol: S + A + GP0 - G. - return Body.getVA<ELFT>(A) + File.getMipsGp0(); case R_GOT_OFF: return Body.getGotOffset<ELFT>() + A; case R_MIPS_GOT_LOCAL: diff --git a/lld/ELF/InputSection.h b/lld/ELF/InputSection.h index c34c94d..1e243e8 100644 --- a/lld/ELF/InputSection.h +++ b/lld/ELF/InputSection.h @@ -37,7 +37,6 @@ enum RelExpr { R_GOT_PC, R_MIPS_GOT, R_MIPS_GOT_LOCAL, - R_MIPS_GP0, R_NEG_TLS, R_PAGE_PC, R_PC, diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index df846dd..8d276ec 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -630,8 +630,10 @@ void Writer<ELFT>::scanRelocs(InputSectionBase<ELFT> &C, ArrayRef<RelTy> Rels) { if (!Config->Pic || Target->isRelRelative(Type) || Expr == R_PC || Expr == R_SIZE || isAbsolute<ELFT>(Body)) { if (Config->EMachine == EM_MIPS && Body.isLocal() && - (Type == R_MIPS_GPREL16 || Type == R_MIPS_GPREL32)) - Expr = R_MIPS_GP0; + (Type == R_MIPS_GPREL16 || Type == R_MIPS_GPREL32)) { + Expr = R_ABS; + Addend += File.getMipsGp0(); + } C.Relocations.push_back({Expr, Type, Offset, Addend, &Body}); continue; } |