diff options
Diffstat (limited to 'lld/ELF/InputSection.cpp')
| -rw-r--r-- | lld/ELF/InputSection.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 4929e0339ff..d26c7400563 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -261,7 +261,7 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd, // that does not have a corresponding symbol. if (Config->EMachine == EM_PPC64 && RI.getType(false) == R_PPC64_TOC) { uintX_t SymVA = getPPC64TocBase() + A; - Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA, 0); + Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA); continue; } @@ -299,8 +299,10 @@ void InputSectionBase<ELFT>::relocate(uint8_t *Buf, uint8_t *BufEnd, Body.isPreemptible()) { continue; } - uintX_t Size = Body.getSize<ELFT>(); - Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA, Size + A); + if (Target->isSizeRel(Type)) + SymVA = Body.getSize<ELFT>() + A; + + Target->relocateOne(BufLoc, BufEnd, Type, AddrLoc, SymVA); } } |

