Skip to content

Commit d4ad627

Browse files
committed
Fix test
1 parent befe780 commit d4ad627

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

test/discard-section.s

Whitespace-only changes.

test/discard-section.sh

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
#!/bin/bash
22
. $(dirname $0)/common.inc
33

4-
cat <<'EOF' | $CC -x assembler -c -o $t/a.o -x assembler -
5-
6-
.section .foo,"a"
7-
.ascii "foo\0"
8-
.section .bar,"a"
9-
.ascii "bar\0"
10-
.section .text
11-
.globl _start
12-
_start:
4+
cat <<EOF | $CC -o $t/a.o -c -xc -
5+
__attribute__((section(".foo"))) int foo;
6+
__attribute__((section(".bar"))) int bar;
7+
int main() {}
138
EOF
149

15-
./mold -o $t/exe0 $t/a.o
16-
readelf -S $t/exe0 | grep '.foo'
17-
readelf -S $t/exe0 | grep '.bar'
10+
$CC -B. -o $t/exe0 $t/a.o
11+
readelf -SW $t/exe0 | grep -F .foo
12+
readelf -SW $t/exe0 | grep -F .bar
1813

19-
./mold -o $t/exe1 $t/a.o --discard-section='.foo'
20-
readelf -S $t/exe1 | grep -v '.foo'
21-
readelf -S $t/exe1 | grep '.bar'
14+
$CC -B. -o $t/exe1 $t/a.o -Wl,--discard-section=.foo
15+
readelf -SW $t/exe1 | not grep -F .foo
16+
readelf -SW $t/exe1 | grep -F .bar
2217

23-
./mold -o $t/exe2 $t/a.o --discard-section='foo' --discard-section='boo' --no-discard-section='foo'
24-
readelf -S $t/exe2 | grep '.foo'
25-
readelf -S $t/exe2 | grep -v '.bar'
18+
$CC -B. -o $t/exe2 $t/a.o -Wl,--discard-section=.foo,--discard-section=.bar,--no-discard-section=.foo
19+
readelf -SW $t/exe2 | grep -F .foo
20+
readelf -SW $t/exe2 | not grep -F .bar

0 commit comments

Comments
 (0)