[PATCH] D41954: [WebAssembly] Add symbol table to LLVM, 1/2

Nicholas Wilson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 31 15:24:08 PST 2018


ncw added inline comments.


================
Comment at: lib/Object/WasmObjectFile.cpp:458
         Init.FunctionIndex = readVaruint32(Ptr);
-        if (!isValidFunctionIndex(Init.FunctionIndex))
+        if (!isValidFunctionSymbolIndex(Init.FunctionIndex))
           return make_error<GenericBinaryError>("Invalid function index: " +
----------------
sbc100 wrote:
> So we want to INIT_FUNCS to refer to symbols rather than functions?
I think so. An init func could perfectly well be a weak symbol like a C++ inline ctor or something - I don't think the linking conventions should force the frontend into always emitting a non-discardable thunk for init functions (rather than allowing the init declaration to link to a shared symbol).

We should add a test for this at some point I guess. I've just checked and the following really does work: `void __attribute__((weak,constructor)) myFunc() {}`.


Repository:
  rL LLVM

https://reviews.llvm.org/D41954





More information about the llvm-commits mailing list