Debian Codegraph @

test/z-pack-relative-relocs.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 . $(dirnamescip-shell system . . dirname. $0)/common.inc
3
4 catscip-shell system . . cat. <<EOF | $CC -o $t/a.o -fPIC -c -xc -
5 #include <stdio.h>
6 int main() {
7 printf("Hello world\n");
8 }
9 EOF
10
11 $CC -o $t/exe1 $t/a.o -pie -Wl,-z,pack-relative-relocs 2> /dev/nullscip-shell filesystem . . `/dev/null`. || skip
12 readelfscip-shell system . . readelf. -WS $t/exe1 | grepscip-shell system . . grep. -F .relr.dyn || skip
13 $QEMU $t/exe1 2> /dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. Hello || skip
14
15 $CC -B. -o $t/exe2 $t/a.o -pie -Wl,-z,pack-relative-relocs
16 $QEMU $t/exe2 | grepscip-shell system . . grep. Hello
17
18 readelfscip-shell system . . readelf. --dynamic $t/exe2 > $t/log2
19 grepscip-shell system . . grep. -Ew 'RELR|<unknown>: 24' $t/log2
20 grepscip-shell system . . grep. -Ew 'RELRSZ|<unknown>: 23' $t/log2
21 grepscip-shell system . . grep. -Ew 'RELRENT|<unknown>: 25' $t/log2