Skip to content

Commit 4af8e15

Browse files
committed
hm
1 parent 03d5720 commit 4af8e15

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

build/musl-pie-linker.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/bin/bash
22
# Linker wrapper for musl builds that need dynamic GTK.
3-
# Replaces -static-pie with -pie to allow dynamic library loading
4-
# while keeping musl libc statically linked.
3+
# Injects -Bdynamic before -l flags so system libs link dynamically
4+
# while Rust libs (.rlib) stay static.
55
args=()
6+
found_first_l=false
67
for arg in "$@"; do
7-
if [ "$arg" = "-static-pie" ]; then
8-
args+=("-pie")
9-
else
10-
args+=("$arg")
8+
# Insert -Bdynamic right before the first -l flag
9+
if [[ "$arg" == -l* ]] && [ "$found_first_l" = false ]; then
10+
args+=("-Wl,-Bdynamic")
11+
found_first_l=true
1112
fi
13+
args+=("$arg")
1214
done
1315
exec cc "${args[@]}"

0 commit comments

Comments
 (0)