[PATCH] D71738: [lld][WebAssembly] Add libcall symbols to the link when LTO is being used.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 11:38:59 PST 2020


pcc added inline comments.


================
Comment at: lld/wasm/Driver.cpp:450
+    MemoryBufferRef mb = lazySym->getMemberBuffer();
+    if (isBitcode(mb))
+      lazySym->fetch();
----------------
sbc100 wrote:
> pcc wrote:
> > Do you really need the `isBitcode` check in the wasm linker? We needed it in the ELF linker because of some badly behaving libgcc functions, but maybe wasm doesn't have anything like that?
> But then wouldn't we end up fetching native object from libraries unnecessarily?
> 
> Without this check, if (for example) compiler-rt and libc are compiled as native object files, wouldn't we be loading in a lot of objects that we might never need. 
Sure, but does that matter? If the user passes `--gc-sections` (meaning that they care about binary size) that shouldn't make a difference to the final output file, I would have thought. Yes, there would be some overhead from loading the object files but maybe it's not enough to worry about. I think either way would be fine with me though.


================
Comment at: lld/wasm/Driver.cpp:768
+  // consequences. For example, the libgcc implementation of
+  // __sync_val_compare_and_swap_8 on 32-bit ARM pulls in an .init_array entry
+  // that aborts the program if the Linux kernel does not support 64-bit
----------------
This comment talks about the issue that we hit on ARM and doesn't apply to wasm. I guess you could talk about performance or file size here instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71738





More information about the llvm-commits mailing list