[ELF] - Fix for PR28976 - Corrupted section contents when using linker scripts
This is fix for PR28976.
Problem was that in scanRelocs, we computed relocation offset too early
for case when linkerscript was used. Patch fixes the issue
delaying the calculation.
Differential revision: https://reviews.llvm.org/D23655
llvm-svn: 279264
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index dca84e1..0f03857 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -566,7 +566,7 @@
continue;
Offset = PieceI->OutputOff + RI.r_offset - PieceI->InputOff;
} else {
- Offset = C.getOffset(RI.r_offset);
+ Offset = RI.r_offset;
}
// This relocation does not require got entry, but it is relative to got and