[PATCH] D119666: [lld][WebAssembly] Apply global relocs before data relocs
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 16 14:31:36 PST 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdabbab686151: [lld][WebAssembly] Apply global relocs before data relocs (authored by sbc100).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119666/new/
https://reviews.llvm.org/D119666
Files:
lld/test/wasm/pie.ll
lld/wasm/Writer.cpp
Index: lld/wasm/Writer.cpp
===================================================================
--- lld/wasm/Writer.cpp
+++ lld/wasm/Writer.cpp
@@ -1253,6 +1253,11 @@
{
raw_string_ostream os(bodyContent);
writeUleb128(os, 0, "num locals");
+ if (WasmSym::applyGlobalRelocs) {
+ writeU8(os, WASM_OPCODE_CALL, "CALL");
+ writeUleb128(os, WasmSym::applyGlobalRelocs->getFunctionIndex(),
+ "function index");
+ }
if (WasmSym::initMemory) {
writeU8(os, WASM_OPCODE_CALL, "CALL");
writeUleb128(os, WasmSym::initMemory->getFunctionIndex(),
@@ -1264,11 +1269,6 @@
writeUleb128(os, WasmSym::applyDataRelocs->getFunctionIndex(),
"function index");
}
- if (WasmSym::applyGlobalRelocs) {
- writeU8(os, WASM_OPCODE_CALL, "CALL");
- writeUleb128(os, WasmSym::applyGlobalRelocs->getFunctionIndex(),
- "function index");
- }
writeU8(os, WASM_OPCODE_END, "END");
}
createFunction(WasmSym::startFunction, bodyContent);
Index: lld/test/wasm/pie.ll
===================================================================
--- lld/test/wasm/pie.ll
+++ lld/test/wasm/pie.ll
@@ -88,8 +88,8 @@
; DISASSEM: <__wasm_start>:
; DISASSEM-EMPTY:
-; DISASSEM-NEXT: call 2
; DISASSEM-NEXT: call 3
+; DISASSEM-NEXT: call 2
; DISASSEM-NEXT: end
; Run the same test with threading support. In this mode
@@ -107,8 +107,8 @@
; DISASSEM-SHMEM: <__wasm_start>:
; DISASSEM-SHMEM-EMPTY:
-; DISASSEM-SHMEM-NEXT: call 3
; DISASSEM-SHMEM-NEXT: call 5
+; DISASSEM-SHMEM-NEXT: call 3
; DISASSEM-SHMEM-NEXT: end
; SHMEM: FunctionNames:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119666.409412.patch
Type: text/x-patch
Size: 1725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220216/56d62bbc/attachment.bin>
More information about the llvm-commits
mailing list