[clang] [lld] [lld][WebAssembly] Remove the experimental warning for PIC/dynamic linking (PR #196566)
https://github.com/sbc100 updated
https://github.com/llvm/llvm-project/pull/196566
>From ca3983847703d572d4bcc58ed56b621305deed15 Mon Sep 17 00:00:00 2001
From: Sam Clegg
Date: Fri, 8 May 2026 09:00:47 -0700
Subject: [PATCH] [lld][WebAssembly] Remove the experimental warning for
PIC/dynamic linking
The currently dynamic linking support has been used for several years
not both in emscripten and in wasi-sdk.
This change removes the linker warning and the corresponding
`--experimental-pic` flag.
If we do want to still make breaking changes to the dylink format we can
rename the `dylink.1` section (which already contains a version number).
This change is leads the way for enabling shared libraries by default
in emscripten.
---
clang/lib/Interpreter/Wasm.cpp| 1 -
lld/docs/WebAssembly.rst | 4 +--
lld/test/wasm/bad-data-relocs.s | 2 +-
lld/test/wasm/bsymbolic.s | 4 +--
lld/test/wasm/compact-imports.s | 2 +-
lld/test/wasm/data-segments.ll| 6 ++--
lld/test/wasm/dylink-non-pie.s| 2 +-
lld/test/wasm/dylink.s| 12
lld/test/wasm/global-base.test| 4 +--
lld/test/wasm/libsearch.s | 28 +--
lld/test/wasm/lto/pic-empty.s | 2 +-
lld/test/wasm/lto/relocation-model.ll | 2 +-
lld/test/wasm/no-shlib-sigcheck.s | 10 +++
lld/test/wasm/pie.s | 6 ++--
lld/test/wasm/rpath.s | 2 +-
lld/test/wasm/runtime-relocations-himem.s | 2 +-
lld/test/wasm/shared-export-dynamic.s | 4 +--
lld/test/wasm/shared-lazy.s | 12
lld/test/wasm/shared-memory-bss.s | 2 +-
lld/test/wasm/shared-needed.s | 6 ++--
lld/test/wasm/shared-weak-symbols.s | 2 +-
lld/test/wasm/shared-weak-undefined.s | 4 +--
lld/test/wasm/shared.s| 2 +-
lld/test/wasm/shared64.s | 2 +-
lld/test/wasm/static-error.s | 4 +--
lld/test/wasm/tag-section.ll | 2 +-
lld/test/wasm/tls-export.s| 2 +-
lld/test/wasm/tls-non-shared-memory-basic.s | 2 +-
lld/test/wasm/tls-non-shared-memory.s | 6 ++--
lld/test/wasm/tls-relocations.s | 2 +-
lld/test/wasm/undef-shared.s | 2 +-
lld/test/wasm/undefined-data.s| 2 +-
lld/test/wasm/unresolved-symbols-dynamic.s| 3 +-
lld/test/wasm/unresolved-symbols.s| 2 +-
lld/test/wasm/unsupported-pic-relocations.s | 12
lld/test/wasm/unsupported-pic-relocations64.s | 12
lld/test/wasm/weak-undefined-pic.s| 2 +-
lld/wasm/Config.h | 6 ++--
lld/wasm/Driver.cpp | 23 ---
lld/wasm/Options.td | 4 +--
40 files changed, 91 insertions(+), 118 deletions(-)
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
index 007227c73dc5f..96600cf9fa6d0 100644
--- a/clang/lib/Interpreter/Wasm.cpp
+++ b/clang/lib/Interpreter/Wasm.cpp
@@ -120,7 +120,6 @@ llvm::Error
WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
std::vector LinkerArgs = {"wasm-ld",
"-shared",
"--import-memory",
- "--experimental-pic",
"--stack-first",
"--allow-undefined",
ObjectFileName.c_str(),
diff --git a/lld/docs/WebAssembly.rst b/lld/docs/WebAssembly.rst
index a7e1bc4cbe97b..389fc0ac25553 100644
--- a/lld/docs/WebAssembly.rst
+++ b/lld/docs/WebAssembly.rst
@@ -108,9 +108,7 @@ WebAssembly-specific options:
this means inputs should be compiled with `-fPIC` (i.e. `pic` or
`dynamic-no-pic` relocation models). This options is useful for linking
binaries that are themselves static (non-relocatable) but whose undefined
- symbols are resolved by a dynamic linker. Since the dynamic linking API
is
- experimental, this option currently requires `--experimental-pic` to also
- be specified.
+ symbols are resolved by a dynamic linker.
.. option:: --import-memory
diff --git a/lld/test/wasm/bad-data-relocs.s b/lld/test/wasm/bad-data-relocs.s
index 7e2ef3e1dc3b7..6e95c5bf58ac1 100644
--- a/lld/test/wasm/bad-data-relocs.s
+++ b/lld/test/wasm/bad-data-relocs.s
@@ -2,7 +2,7 @@
## generated in `-shared/`-pie` binaries.
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
-# RUN: not wasm-ld -pie --experimental-pic %t.o -o %t.wasm 2>&1 | FileCheck %s
+# RUN: not wasm-ld -pie %t.o -o %t.wasm 2>&1 | FileCheck %s
# CHECK: wasm-ld: error: invalid run
[clang] [lld] [lld][WebAssembly] Remove the experimental warning for PIC/dynamic linking (PR #196566)
https://github.com/sbc100 created
https://github.com/llvm/llvm-project/pull/196566
The current dynamic linking support has been used for several years not both in
emscripten and in wasi-sdk and is documented
https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md.
We did/do have have plans to develop another version of the dynamic linking ABI
that doesn't use a global symbol namespace, and that can still happen, but the
current API is clearly production worthy regardless of future plans.
This change removes the linker warning and the corresponding
`--experimental-pic` flag.
If we do want to still make breaking changes to the dylink format we can rename
the `dylink.1` section (which already contains a version number).
This change is leads the way for enabling shared libraries by default in
emscripten.
>From 54760cc155a451cc5d3da2f1ac7156d6eca32560 Mon Sep 17 00:00:00 2001
From: Sam Clegg
Date: Fri, 8 May 2026 09:00:47 -0700
Subject: [PATCH] [lld][WebAssembly] Remove the experimental warning for
PIC/dynamic linking
The currently dynamic linking support has been used for several years
not both in emscripten and in wasi-sdk.
This change removes the linker warning and the corresponding
`--experimental-pic` flag.
If we do want to still make breaking changes to the dylink format we can
rename the `dylink.1` section (which already contains a version number).
This change is leads the way for enabling shared libraries by default
in emscripten.
---
clang/lib/Interpreter/Wasm.cpp| 1 -
lld/docs/WebAssembly.rst | 4 +--
lld/test/wasm/bad-data-relocs.s | 2 +-
lld/test/wasm/bsymbolic.s | 4 +--
lld/test/wasm/compact-imports.s | 2 +-
lld/test/wasm/data-segments.ll| 6 ++--
lld/test/wasm/dylink-non-pie.s| 2 +-
lld/test/wasm/dylink.s| 12
lld/test/wasm/global-base.test| 4 +--
lld/test/wasm/libsearch.s | 28 +--
lld/test/wasm/lto/pic-empty.s | 2 +-
lld/test/wasm/lto/relocation-model.ll | 2 +-
lld/test/wasm/no-shlib-sigcheck.s | 10 +++
lld/test/wasm/pie.s | 6 ++--
lld/test/wasm/rpath.s | 2 +-
lld/test/wasm/runtime-relocations-himem.s | 2 +-
lld/test/wasm/shared-export-dynamic.s | 4 +--
lld/test/wasm/shared-lazy.s | 12
lld/test/wasm/shared-memory-bss.s | 2 +-
lld/test/wasm/shared-needed.s | 6 ++--
lld/test/wasm/shared-weak-symbols.s | 2 +-
lld/test/wasm/shared-weak-undefined.s | 4 +--
lld/test/wasm/shared.s| 2 +-
lld/test/wasm/shared64.s | 2 +-
lld/test/wasm/static-error.s | 4 +--
lld/test/wasm/tag-section.ll | 2 +-
lld/test/wasm/tls-export.s| 2 +-
lld/test/wasm/tls-non-shared-memory-basic.s | 2 +-
lld/test/wasm/tls-non-shared-memory.s | 6 ++--
lld/test/wasm/tls-relocations.s | 2 +-
lld/test/wasm/undef-shared.s | 2 +-
lld/test/wasm/undefined-data.s| 2 +-
lld/test/wasm/unresolved-symbols.s| 2 +-
lld/test/wasm/unsupported-pic-relocations.s | 12
lld/test/wasm/unsupported-pic-relocations64.s | 12
lld/test/wasm/weak-undefined-pic.s| 2 +-
lld/wasm/Config.h | 6 ++--
lld/wasm/Driver.cpp | 23 ---
lld/wasm/Options.td | 4 +--
39 files changed, 90 insertions(+), 116 deletions(-)
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
index 007227c73dc5f..96600cf9fa6d0 100644
--- a/clang/lib/Interpreter/Wasm.cpp
+++ b/clang/lib/Interpreter/Wasm.cpp
@@ -120,7 +120,6 @@ llvm::Error
WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
std::vector LinkerArgs = {"wasm-ld",
"-shared",
"--import-memory",
- "--experimental-pic",
"--stack-first",
"--allow-undefined",
ObjectFileName.c_str(),
diff --git a/lld/docs/WebAssembly.rst b/lld/docs/WebAssembly.rst
index a7e1bc4cbe97b..389fc0ac25553 100644
--- a/lld/docs/WebAssembly.rst
+++ b/lld/docs/WebAssembly.rst
@@ -108,9 +108,7 @@ WebAssembly-specific options:
this means inputs should be compiled with `-fPIC` (i.e. `pic` or
`dynamic-no-pic` relocation models). This options is useful for linking
binaries that are themselves static (non-relocatable) but whose undefined
- symbols are resolved by a dynamic linker. Since the dynamic
[clang] [lld] [lld][WebAssembly] Remove the experimental warning for PIC/dynamic linking (PR #196566)
alexcrichton wrote: There's been a fair bit of work in the realm of StarlingMonkey (js-runtime-compiled-to-wasm) and Python (compiled to wasm) as well as some other interpreter-based languages. In these scenarios dynamic linking is used for the interpreter itself, libc, and any "native plugins" loaded by the interpreter (e.g. the native module behind pandas). AFAIK it's working well for everyone and there's no major complaints so far, but it's also not been a super-stressed part of the ecosystem. In that sense I'd say there's strong validation that it works, but not strong validation that the performance/conventions/tooling are in the right place. Not to say there's points against it either, just that those aspects haven't been stressed. Personally I think this is reasonable to do, and I'd agree it'd still make sense to revisit this in the future for a possible future iteration, but for now the experimental warning isn't buying much. https://github.com/llvm/llvm-project/pull/196566 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [lld][WebAssembly] Remove the experimental warning for PIC/dynamic linking (PR #196566)
github-actions[bot] wrote: # :penguin: Linux x64 Test Results * 98869 tests passed * 2909 tests skipped * 1 test failed ## Failed Tests (click on a test name to see its output) ### RealtimeSanitizer-Unit RealtimeSanitizer-Unit._/Rtsan-x86_64-FileOffset64-Test/RtsanFileTest/OpenCreatesFileWithProperMode ``` Script: -- /home/gha/actions-runner/_work/llvm-project/llvm-project/build/runtimes/runtimes-bins/compiler-rt/lib/rtsan/tests/./Rtsan-x86_64-FileOffset64-Test --gtest_filter=RtsanFileTest.OpenCreatesFileWithProperMode -- /home/gha/actions-runner/_work/llvm-project/llvm-project/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp:440 Value of: stat(GetTemporaryFilePath(), &st) Expected: is equal to 0 Actual: -1 ``` If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label. https://github.com/llvm/llvm-project/pull/196566 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [lld][WebAssembly] Remove the experimental warning for PIC/dynamic linking (PR #196566)
https://github.com/sunfishcode approved this pull request. This sounds like a practical approach at this time. https://github.com/llvm/llvm-project/pull/196566 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [lld][WebAssembly] Remove the experimental warning for PIC/dynamic linking (PR #196566)
llvmorg-github-actions[bot] wrote:
@llvm/pr-subscribers-lld
Author: Sam Clegg (sbc100)
Changes
The current dynamic linking support has been used for several years not both in
emscripten and in wasi-sdk and is documented
https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md.
We did/do have have plans to develop another version of the dynamic linking ABI
that doesn't use a global symbol namespace, and that can still happen, but the
current API is clearly production worthy regardless of future plans.
This change removes the linker warning and the corresponding
`--experimental-pic` flag.
If we do want to still make breaking changes to the dylink format we can rename
the `dylink.1` section (which already contains a version number).
This change is leads the way for enabling shared libraries by default in
emscripten.
---
Patch is 39.42 KiB, truncated to 20.00 KiB below, full version:
https://github.com/llvm/llvm-project/pull/196566.diff
39 Files Affected:
- (modified) clang/lib/Interpreter/Wasm.cpp (-1)
- (modified) lld/docs/WebAssembly.rst (+1-3)
- (modified) lld/test/wasm/bad-data-relocs.s (+1-1)
- (modified) lld/test/wasm/bsymbolic.s (+2-2)
- (modified) lld/test/wasm/compact-imports.s (+1-1)
- (modified) lld/test/wasm/data-segments.ll (+3-3)
- (modified) lld/test/wasm/dylink-non-pie.s (+1-1)
- (modified) lld/test/wasm/dylink.s (+6-6)
- (modified) lld/test/wasm/global-base.test (+2-2)
- (modified) lld/test/wasm/libsearch.s (+14-14)
- (modified) lld/test/wasm/lto/pic-empty.s (+1-1)
- (modified) lld/test/wasm/lto/relocation-model.ll (+1-1)
- (modified) lld/test/wasm/no-shlib-sigcheck.s (+5-5)
- (modified) lld/test/wasm/pie.s (+3-3)
- (modified) lld/test/wasm/rpath.s (+1-1)
- (modified) lld/test/wasm/runtime-relocations-himem.s (+1-1)
- (modified) lld/test/wasm/shared-export-dynamic.s (+2-2)
- (modified) lld/test/wasm/shared-lazy.s (+6-6)
- (modified) lld/test/wasm/shared-memory-bss.s (+1-1)
- (modified) lld/test/wasm/shared-needed.s (+3-3)
- (modified) lld/test/wasm/shared-weak-symbols.s (+1-1)
- (modified) lld/test/wasm/shared-weak-undefined.s (+2-2)
- (modified) lld/test/wasm/shared.s (+1-1)
- (modified) lld/test/wasm/shared64.s (+1-1)
- (modified) lld/test/wasm/static-error.s (+2-2)
- (modified) lld/test/wasm/tag-section.ll (+1-1)
- (modified) lld/test/wasm/tls-export.s (+1-1)
- (modified) lld/test/wasm/tls-non-shared-memory-basic.s (+1-1)
- (modified) lld/test/wasm/tls-non-shared-memory.s (+3-3)
- (modified) lld/test/wasm/tls-relocations.s (+1-1)
- (modified) lld/test/wasm/undef-shared.s (+1-1)
- (modified) lld/test/wasm/undefined-data.s (+1-1)
- (modified) lld/test/wasm/unresolved-symbols.s (+1-1)
- (modified) lld/test/wasm/unsupported-pic-relocations.s (+6-6)
- (modified) lld/test/wasm/unsupported-pic-relocations64.s (+6-6)
- (modified) lld/test/wasm/weak-undefined-pic.s (+1-1)
- (modified) lld/wasm/Config.h (+3-3)
- (modified) lld/wasm/Driver.cpp (-23)
- (modified) lld/wasm/Options.td (+2-2)
``diff
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
index 007227c73dc5f..96600cf9fa6d0 100644
--- a/clang/lib/Interpreter/Wasm.cpp
+++ b/clang/lib/Interpreter/Wasm.cpp
@@ -120,7 +120,6 @@ llvm::Error
WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
std::vector LinkerArgs = {"wasm-ld",
"-shared",
"--import-memory",
- "--experimental-pic",
"--stack-first",
"--allow-undefined",
ObjectFileName.c_str(),
diff --git a/lld/docs/WebAssembly.rst b/lld/docs/WebAssembly.rst
index a7e1bc4cbe97b..389fc0ac25553 100644
--- a/lld/docs/WebAssembly.rst
+++ b/lld/docs/WebAssembly.rst
@@ -108,9 +108,7 @@ WebAssembly-specific options:
this means inputs should be compiled with `-fPIC` (i.e. `pic` or
`dynamic-no-pic` relocation models). This options is useful for linking
binaries that are themselves static (non-relocatable) but whose undefined
- symbols are resolved by a dynamic linker. Since the dynamic linking API
is
- experimental, this option currently requires `--experimental-pic` to also
- be specified.
+ symbols are resolved by a dynamic linker.
.. option:: --import-memory
diff --git a/lld/test/wasm/bad-data-relocs.s b/lld/test/wasm/bad-data-relocs.s
index 7e2ef3e1dc3b7..6e95c5bf58ac1 100644
--- a/lld/test/wasm/bad-data-relocs.s
+++ b/lld/test/wasm/bad-data-relocs.s
@@ -2,7 +2,7 @@
## generated in `-shared/`-pie` binaries.
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
-# RUN: not wasm-ld -pie --experimental-pic %t.o -o %t.wasm 2>&1 | FileCheck %s
+# RUN: not wasm-ld -pie %t.o -o %t.wasm 2>&1 | FileCheck %s
# CHECK: wasm-ld: error: invalid runtime relocation type
[clang] [lld] [lld][WebAssembly] Remove the experimental warning for PIC/dynamic linking (PR #196566)
https://github.com/sbc100 updated
https://github.com/llvm/llvm-project/pull/196566
>From 5b2845843571f377e9ddd013a54d7a1efaa34144 Mon Sep 17 00:00:00 2001
From: Sam Clegg
Date: Fri, 8 May 2026 09:00:47 -0700
Subject: [PATCH] [lld][WebAssembly] Remove the experimental warning for
PIC/dynamic linking
The currently dynamic linking support has been used for several years
not both in emscripten and in wasi-sdk.
This change removes the linker warning and the corresponding
`--experimental-pic` flag.
If we do want to still make breaking changes to the dylink format we can
rename the `dylink.1` section (which already contains a version number).
This change is leads the way for enabling shared libraries by default
in emscripten.
---
clang/lib/Interpreter/Wasm.cpp| 1 -
lld/docs/WebAssembly.rst | 4 +--
lld/test/wasm/bad-data-relocs.s | 2 +-
lld/test/wasm/bsymbolic.s | 4 +--
lld/test/wasm/compact-imports.s | 2 +-
lld/test/wasm/data-segments.ll| 6 ++--
lld/test/wasm/dylink-non-pie.s| 2 +-
lld/test/wasm/dylink.s| 12
lld/test/wasm/global-base.test| 4 +--
lld/test/wasm/libsearch.s | 28 +--
lld/test/wasm/lto/pic-empty.s | 2 +-
lld/test/wasm/lto/relocation-model.ll | 2 +-
lld/test/wasm/no-shlib-sigcheck.s | 10 +++
lld/test/wasm/pie.s | 6 ++--
lld/test/wasm/rpath.s | 2 +-
lld/test/wasm/runtime-relocations-himem.s | 2 +-
lld/test/wasm/shared-export-dynamic.s | 4 +--
lld/test/wasm/shared-lazy.s | 12
lld/test/wasm/shared-memory-bss.s | 2 +-
lld/test/wasm/shared-needed.s | 6 ++--
lld/test/wasm/shared-weak-symbols.s | 2 +-
lld/test/wasm/shared-weak-undefined.s | 4 +--
lld/test/wasm/shared.s| 2 +-
lld/test/wasm/shared64.s | 2 +-
lld/test/wasm/static-error.s | 4 +--
lld/test/wasm/tag-section.ll | 2 +-
lld/test/wasm/tls-export.s| 2 +-
lld/test/wasm/tls-non-shared-memory-basic.s | 2 +-
lld/test/wasm/tls-non-shared-memory.s | 6 ++--
lld/test/wasm/tls-relocations.s | 2 +-
lld/test/wasm/undef-shared.s | 2 +-
lld/test/wasm/undefined-data.s| 2 +-
lld/test/wasm/unresolved-symbols-dynamic.s| 3 +-
lld/test/wasm/unresolved-symbols.s| 2 +-
lld/test/wasm/unsupported-pic-relocations.s | 12
lld/test/wasm/unsupported-pic-relocations64.s | 12
lld/test/wasm/weak-undefined-pic.s| 2 +-
lld/wasm/Config.h | 6 ++--
lld/wasm/Driver.cpp | 23 ---
lld/wasm/Options.td | 4 +--
40 files changed, 91 insertions(+), 118 deletions(-)
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
index 007227c73dc5f..96600cf9fa6d0 100644
--- a/clang/lib/Interpreter/Wasm.cpp
+++ b/clang/lib/Interpreter/Wasm.cpp
@@ -120,7 +120,6 @@ llvm::Error
WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
std::vector LinkerArgs = {"wasm-ld",
"-shared",
"--import-memory",
- "--experimental-pic",
"--stack-first",
"--allow-undefined",
ObjectFileName.c_str(),
diff --git a/lld/docs/WebAssembly.rst b/lld/docs/WebAssembly.rst
index a7e1bc4cbe97b..389fc0ac25553 100644
--- a/lld/docs/WebAssembly.rst
+++ b/lld/docs/WebAssembly.rst
@@ -108,9 +108,7 @@ WebAssembly-specific options:
this means inputs should be compiled with `-fPIC` (i.e. `pic` or
`dynamic-no-pic` relocation models). This options is useful for linking
binaries that are themselves static (non-relocatable) but whose undefined
- symbols are resolved by a dynamic linker. Since the dynamic linking API
is
- experimental, this option currently requires `--experimental-pic` to also
- be specified.
+ symbols are resolved by a dynamic linker.
.. option:: --import-memory
diff --git a/lld/test/wasm/bad-data-relocs.s b/lld/test/wasm/bad-data-relocs.s
index 7e2ef3e1dc3b7..6e95c5bf58ac1 100644
--- a/lld/test/wasm/bad-data-relocs.s
+++ b/lld/test/wasm/bad-data-relocs.s
@@ -2,7 +2,7 @@
## generated in `-shared/`-pie` binaries.
# RUN: llvm-mc -filetype=obj -triple=wasm32-unknown-unknown -o %t.o %s
-# RUN: not wasm-ld -pie --experimental-pic %t.o -o %t.wasm 2>&1 | FileCheck %s
+# RUN: not wasm-ld -pie %t.o -o %t.wasm 2>&1 | FileCheck %s
# CHECK: wasm-ld: error: invalid run
[clang] [lld] [lld][WebAssembly] Remove the experimental warning for PIC/dynamic linking (PR #196566)
sbc100 wrote: @alexcrichton who in wasi-libc world has been doing the most work with dynamic linking? Perhaps they could chime in here if needed? https://github.com/llvm/llvm-project/pull/196566 ___ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
