[PATCH] D44451: [WebAssembly] Fix expected contents of relocations with addends
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 13 16:38:29 PDT 2018
sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff, jfb.
This fixes issues found on the wasm waterfall related to relocations
with addends.
We really need to added tests that include such relocations but
I'd like to land this now to fix the waterfall if possible.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D44451
Files:
wasm/InputChunks.cpp
wasm/InputFiles.cpp
Index: wasm/InputFiles.cpp
===================================================================
--- wasm/InputFiles.cpp
+++ wasm/InputFiles.cpp
@@ -77,7 +77,8 @@
if (Sym.isUndefined())
return 0;
const WasmSegment& Segment = WasmObj->dataSegments()[Sym.Info.DataRef.Segment];
- return Segment.Data.Offset.Value.Int32 + Sym.Info.DataRef.Offset;
+ return Segment.Data.Offset.Value.Int32 + Sym.Info.DataRef.Offset +
+ Reloc.Addend;
}
case R_WEBASSEMBLY_TYPE_INDEX_LEB:
return Reloc.Index;
@@ -102,7 +103,7 @@
case R_WEBASSEMBLY_MEMORY_ADDR_LEB:
if (auto *Sym = dyn_cast<DefinedData>(getDataSymbol(Reloc.Index)))
return Sym->getVirtualAddress() + Reloc.Addend;
- return Reloc.Addend;
+ return 0;
case R_WEBASSEMBLY_TYPE_INDEX_LEB:
return TypeMap[Reloc.Index];
case R_WEBASSEMBLY_FUNCTION_INDEX_LEB:
Index: wasm/InputChunks.cpp
===================================================================
--- wasm/InputChunks.cpp
+++ wasm/InputChunks.cpp
@@ -55,7 +55,8 @@
if (Relocations.empty())
return;
- DEBUG(dbgs() << "applying relocations: count=" << Relocations.size() << "\n");
+ DEBUG(dbgs() << "applying relocations: " << getName()
+ << " count=" << Relocations.size() << "\n");
int32_t Off = OutputOffset - getInputSectionOffset();
for (const WasmRelocation &Rel : Relocations) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44451.138277.patch
Type: text/x-patch
Size: 1386 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180313/fb7d5490/attachment.bin>
More information about the llvm-commits
mailing list