diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-05-24 12:17:11 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-05-24 12:17:11 +0000 |
| commit | 29da3e35774eeadef81310d3767c12e93e814e06 (patch) | |
| tree | 0e2fa56f5b998f964eb17a90568cbcea5afd81fb | |
| parent | fe3a2f1b8100a145cbda09921433c355cb64bcb0 (diff) | |
| download | bcm5719-llvm-29da3e35774eeadef81310d3767c12e93e814e06.tar.gz bcm5719-llvm-29da3e35774eeadef81310d3767c12e93e814e06.zip | |
Simplify. Thanks to Rui for the suggestion.
llvm-svn: 270555
| -rw-r--r-- | lld/ELF/InputSection.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index f3c2e46d45f..cc3e939a0fb 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -317,12 +317,6 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd) { uint64_t SymVA = SignExtend64<Bits>( getSymVA<ELFT>(Type, A, AddrLoc, *Rel.Sym, BufLoc, *File, Expr)); - if (Expr == R_PPC_PLT_OPD) { - uint32_t Nop = 0x60000000; - if (BufLoc + 8 <= BufEnd && read32be(BufLoc + 4) == Nop) - write32be(BufLoc + 4, 0xe8410028); // ld %r2, 40(%r1) - } - switch (Expr) { case R_RELAX_TLS_IE_TO_LE: Target->relaxTlsIeToLe(BufLoc, Type, SymVA); @@ -336,6 +330,11 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd) { case R_RELAX_TLS_GD_TO_IE: Target->relaxTlsGdToIe(BufLoc, Type, SymVA); break; + case R_PPC_PLT_OPD: + // Patch a nop (0x60000000) to a ld. + if (BufLoc + 8 <= BufEnd && read32be(BufLoc + 4) == 0x60000000) + write32be(BufLoc + 4, 0xe8410028); // ld %r2, 40(%r1) + // fallthrough default: Target->relocateOne(BufLoc, Type, SymVA); break; |

