[PATCH] D145308: [lld][WebAssembly] Initial support for stub objects

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 17:01:40 PST 2023


dschuff added inline comments.


================
Comment at: lld/docs/WebAssembly.rst:78
 
+.. option:: --allow-undefined-file=<filename>
+
----------------
Can this be split out from the stub support? or is it tightly coupled somehow?


================
Comment at: lld/docs/WebAssembly.rst:217
+Here we are saying that ``foo`` is allowed to be imported (undefined) but that
+if it is imported then the module must also export ``malloc`` and ``free``.  If
+``foo`` is undefined in the module, but the module does not define ``malloc``
----------------
Can you clarify this a little? which module must export malloc and free? The module that imports foo? Any module loaded before foo is loaded at runtime?

Why do we need to have this per-symbol dependence rather than just having a list of symbols that the dylib imports and exports? Is our linking model actually that granular at runtime?


================
Comment at: lld/test/wasm/Inputs/libstub.so:4
+foo: foodep1,foodep2
+# This symbols as no dependencies
+bar
----------------



================
Comment at: lld/wasm/Driver.cpp:283
     break;
+  case file_magic::unknown:
+    if (mbref.getBuffer().starts_with("#STUB\n")) {
----------------
Any particular reason not to just make #STUB the file magic for a new kind of file? or is that not done for text files?


================
Comment at: lld/wasm/InputFiles.cpp:684
+StringRef strip(StringRef s) {
+  while (s.starts_with(" ")) {
+    s = s.drop_front();
----------------
is there a more generic isspace-type function that would be better here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145308



More information about the llvm-commits mailing list