-
-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve compatibility of precedences in version script patterns
Previously, symbol names or wildcard patterns in version script files were processed strictly from top to bottom. When a single symbol matches two or more patterns, the first one was given precedence. However, GNU ld appears to treat exact matches differently, assigning them higher precedence over wildcard patterns. This discrepancy led to programs linked with Qt 6.6.1 using mold failing to launch. Fixes #1158
- Loading branch information
Showing
3 changed files
with
77 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
. $(dirname $0)/common.inc | ||
|
||
cat <<'EOF' > $t/a.ver | ||
VER1 { foo*; }; | ||
VER2 { foo_x; }; | ||
EOF | ||
|
||
cat <<EOF | $CC -fPIC -c -o $t/b.o -xc - | ||
void foo_x() {} | ||
void foo_y() {} | ||
void foo_z() {} | ||
EOF | ||
|
||
$CC -B. -shared -Wl,--version-script=$t/a.ver -o $t/c.so $t/b.o | ||
readelf -W --dyn-syms $t/c.so > $t/log | ||
grep -Fq 'foo_x@@VER2' $t/log | ||
grep -Fq 'foo_y@@VER1' $t/log | ||
grep -Fq 'foo_z@@VER1' $t/log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
. $(dirname $0)/common.inc | ||
|
||
cat <<'EOF' > $t/a.ver | ||
VER1 { foo_x; }; | ||
VER2 { foo*; }; | ||
EOF | ||
|
||
cat <<EOF | $CC -fPIC -c -o $t/b.o -xc - | ||
void foo_x() {} | ||
void foo_y() {} | ||
void foo_z() {} | ||
EOF | ||
|
||
$CC -B. -shared -Wl,--version-script=$t/a.ver -o $t/c.so $t/b.o | ||
readelf -W --dyn-syms $t/c.so > $t/log | ||
grep -Fq 'foo_x@@VER1' $t/log | ||
grep -Fq 'foo_y@@VER2' $t/log | ||
grep -Fq 'foo_z@@VER2' $t/log |