[PATCH] D92038: [lld][WebAssembly] Ensure stub symbols always get address 0

Alon Zakai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 25 08:46:36 PST 2020


kripken accepted this revision.
kripken added a comment.
This revision is now accepted and ready to land.

I don't know enough to tell if these changes are sufficient, but they make sense to me.



================
Comment at: lld/test/wasm/weak-undefined-pic.s:47
+# Global 'undefined_weak:foo' representing the GOT entry for foo
+# Unlike other internal GOT entries that need to mutable this one
+# is immutable and not updated by `__wasm_apply_relocs`
----------------



================
Comment at: lld/wasm/SymbolTable.cpp:676
                                  nullptr, func);
-  // Ensure it compares equal to the null pointer, and so that table relocs
-  // don't pull in the stub body (only call-operand relocs should do that).
-  func->setTableIndex(0);
+  // Ensure it the stub function doesn't get a table entry.  Its address
+  // should alwasys compare equal to the null pointer.
----------------



================
Comment at: lld/wasm/SyntheticSections.cpp:335
+    // In the case of dynamic linking, internal GOT entries
+    // need to be mutable since the get updated to the correct
+    // runtime value during `__wasm_apply_relocs`.
----------------



================
Comment at: lld/wasm/SyntheticSections.cpp:386
+  // functions should be zero and they should they don't appear in the table.
+  // The only exist so that the calls to missing functions can validate.
+  if (sym->hasTableIndex() || sym->isStub)
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92038/new/

https://reviews.llvm.org/D92038



More information about the llvm-commits mailing list