Debian Codegraph @

test/arch-x86_64-lto-comdat-mixed.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 . $(dirnamescip-shell system . . dirname. $0)/common.inc
3
4 # This regression reproduces a mixed LTO + regular-object COMDAT case.
5 # The regular object has a non-COMDAT section referring to a symbol in a
6 # COMDAT group with signature "mix". An LTO object contributes the same
7 # COMDAT key. If IR COMDAT ownership is allowed to override reachable regular
8 # object ownership, the regular COMDAT member can be discarded incorrectly.
9
10 [scip-shell system . . `[`. $MACHINE = $(unamescip-shell system . . uname. -m) ] || skip
11
12 CLANG="${TEST_CLANG:-clang}"
13 $CLANG --version >& /dev/null || skip
14 echoscip-shell system . . echo. 'int main() {}' | $CLANG -B. -flto -o /dev/nullscip-shell filesystem . . `/dev/null`. -xc - >& /dev/null || skip
15
16 catscip-shell system . . cat. <<'EOF' > $t/a.ll
17 $mix = comdat any
18 @mix_lto = global i32 1, comdat($mix)
19 EOF
20
21 catscip-shell system . . cat. <<'EOF' > $t/b.s
22 .globl keep_me
23 .section .text.keep_me,"axG",@progbits,mix,comdat
24 keep_me:
25 ret
26
27 .text
28 .globl main
29 main:
30 call keep_me
31 xor %eax, %eax
32 ret
33 EOF
34
35 $CLANG -S -emit-llvm -flto -o $t/a.bc $t/a.ll
36 $CC -o $t/b.o -c -x assembler $t/b.s
37 $CLANG -B. -o $t/exe -flto $t/a.bc $t/b.o
38
39 $QEMU $t/exe