[lld] [lld][WebAssembly]: Restore non-pie dynamic-linking executable (PR #108146)
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 11 10:27:33 PDT 2024
================
@@ -913,7 +913,8 @@ static void createSyntheticSymbols() {
}
if (ctx.isPic ||
- config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic) {
+ config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic ||
+ !config->isStatic) {
----------------
sbc100 wrote:
I wonder if can replace `ctx.isPic` with ` !config->isStatic` above? Does it make sense to allow `-shared` + `-static`? Or `-pie` + `-static`?
I wonder if we need a better way to detect if dynamic linking used at all since you can imagine a case where `isStatic` is true, but we do have dynamic linking. For example:
```
$ wasm-ld foo.o -Bdynamic -ldylib -Bstatic -lstaticlib
```
In that case since `-Bstatic` comes last on the command line the `config->isStatic` will be false even though we include libdylib.so dyanmically.
Another example:
```
wasm-ld foo.o libdylib.so libstaticlib.a
```
Here `config->isStatic` will remain false even though dynamic linking is used.
```
https://github.com/llvm/llvm-project/pull/108146
More information about the llvm-commits
mailing list