[lld] [lld][WebAssembly]: Restore non-pie dynamic-linking executable (PR #108146)

YAMAMOTO Takashi via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 17:01:22 PDT 2024


================
@@ -913,7 +913,8 @@ static void createSyntheticSymbols() {
   }
 
   if (ctx.isPic ||
-      config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic) {
+      config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic ||
+      !config->isStatic) {
----------------
yamt 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.

i guess it's simpler to defer the decision to createApplyDataRelocationsFunction.
how do you think?

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


More information about the llvm-commits mailing list