-
-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ELF] Do not corrupt compressed debug sections on i386
Previously, if an input debug section is compressed, mold produced corrupted output debug section on i386. Fixes #361
- Loading branch information
Showing
3 changed files
with
52 additions
and
3 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,33 @@ | ||
#!/bin/bash | ||
export LANG= | ||
set -e | ||
CC="${CC:-cc}" | ||
CXX="${CXX:-c++}" | ||
testname=$(basename "$0" .sh) | ||
echo -n "Testing $testname ... " | ||
cd "$(dirname "$0")"/../.. | ||
mold="$(pwd)/mold" | ||
t=out/test/elf/$testname | ||
mkdir -p $t | ||
|
||
[ "$(uname -m)" = x86_64 ] || { echo skipped; exit; } | ||
|
||
which dwarfdump >& /dev/null || { echo skipped; exit; } | ||
|
||
cat <<EOF | $CXX -c -o $t/a.o -g -gz=zlib-gnu -xc++ - -m32 | ||
int main() { | ||
return 0; | ||
} | ||
EOF | ||
|
||
cat <<EOF | $CXX -c -o $t/b.o -g -gz=zlib -xc++ - -m32 | ||
int foo() { | ||
return 0; | ||
} | ||
EOF | ||
|
||
$CC -B. -o $t/exe $t/a.o $t/b.o -m32 | ||
dwarfdump $t/exe > /dev/null | ||
readelf --sections $t/exe | fgrep -q .debug_info | ||
|
||
echo ' OK' |
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