[PATCH] D65922: [lld][WebAssembly] Allow linking of PIC code into static binaries

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 12:10:54 PDT 2019


sbc100 marked an inline comment as done.
sbc100 added inline comments.


================
Comment at: lld/wasm/Driver.cpp:541
     WasmSym::heapBase = symtab->addOptionalDataSymbol("__heap_base");
+    WasmSym::definedMemoryBase = symtab->addOptionalDataSymbol("__memory_base");
+    WasmSym::definedTableBase = symtab->addOptionalDataSymbol("__table_base");
----------------
dschuff wrote:
> does this mean we create these symbols in the output even when not linking PIC code?
Yes, they go from being imported global to local, globals with a fixed value.  wasm-opt can then eliminate them completely.  See the comment in `addGOTEntry`.

As a followup we could instead do linker relaxation to remove references to these.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65922





More information about the llvm-commits mailing list