Skip to content

Commit 82a12e6

Browse files
committed
[lld][WebAssembly] Fix non-pie dynamic-linking executable
The commit 22b7b84 made the symbols provided by shared libraries "defined", and thus effectively made it impossible to generate non-pie dynamically linked executables using --unresolved-symbols=import-dynamic. This commit, based on #109249, fixes it by checking sym->isShared() explictly. (as a bonus, you don't need to rely on --unresolved-symbols=import-dynamic anymore.) Fixes #107387
1 parent 47d42cf commit 82a12e6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lld/wasm/Relocations.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ void scanRelocations(InputChunk *chunk) {
146146

147147
if (ctx.isPic ||
148148
(sym->isUndefined() &&
149-
config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic)) {
149+
config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic) ||
150+
sym->isShared()) {
150151
switch (reloc.Type) {
151152
case R_WASM_TABLE_INDEX_SLEB:
152153
case R_WASM_TABLE_INDEX_SLEB64:

0 commit comments

Comments
 (0)