[lld] [lld][WebAssembly] Always search *.so for -Bdynamic (PR #84288)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 08:22:30 PST 2024


sbc100 wrote:

> In ELF linkers, -Bdynamic is the default. Clang Driver `-static` passes `-static` to the linker.

The problem is that dynamic linking under wasm is still experimental so we probably want to keep the default as static for now.

IIUC we have several options for how to achieve "opt-in" dynamic linking:

1. Make `-Bstatic` the default.   The downside of this is that it will be annoying if we ever want to change it in the future.
2. Don't skip `.so` files in the normal wasi-sdk, but only in an experimental one.  Users of the experimental sdk would have to know that they need to pass `-static` to get the current behaviour.
3. Have the clang driver enforce the "static-by-default" by having it inject `-static` for wasm/wasi targets.   This has the same downside as (1) except direct callers of wasm-ld won't be effected by any change in defaults.

The simplest option for now seem like (1).  

https://github.com/llvm/llvm-project/pull/84288


More information about the llvm-commits mailing list