Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / comdat.s
bloba9a5f5fa3bb6217a0cd292e155f66584c8471248
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/comdat.s -o %t2.o
4 // RUN: ld.lld -shared %t.o %t2.o -o %t
5 // RUN: llvm-objdump -d %t | FileCheck %s
6 // RUN: llvm-readelf -S -s %t | FileCheck --check-prefix=READ %s
8 // Check that we don't crash with --gc-section and that we print a list of
9 // reclaimed sections on stderr.
10 // RUN: ld.lld --gc-sections --print-gc-sections -shared %t.o %t.o %t2.o -o %t \
11 // RUN: 2>&1 | FileCheck --check-prefix=GC %s
12 // GC: removing unused section {{.*}}.o:(.text)
13 // GC: removing unused section {{.*}}.o:(.text3)
14 // GC: removing unused section {{.*}}.o:(.text)
15 // GC: removing unused section {{.*}}.o:(.text)
17 .globl foo
18 .section .text2,"axG",@progbits,foo,comdat,unique,0
19 foo:
20 nop
22 // CHECK: Disassembly of section .text2:
23 // CHECK-EMPTY:
24 // CHECK-NEXT: <foo>:
25 // CHECK-NEXT: nop
26 // CHECK-NOT: nop
28 .section bar, "ax"
29 call foo
31 // CHECK: Disassembly of section bar:
32 // CHECK-EMPTY:
33 // CHECK-NEXT: <bar>:
34 // CHECK-NEXT: callq {{.*}} <foo@plt>
36 .weak zed
37 zed:
38 .section .text3,"axG",@progbits,zed,comdat,unique,0
40 # READ: .text2 PROGBITS {{.*}} AX
41 # READ: .text3 PROGBITS {{.*}} AX
43 # SYM: NOTYPE LOCAL DEFAULT UND
44 # SYM: NOTYPE LOCAL HIDDEN [[#]] _DYNAMIC
45 # SYM: NOTYPE GLOBAL DEFAULT [[#]] foo
46 # SYM: NOTYPE GLOBAL DEFAULT [[#]] zed
47 # SYM: NOTYPE GLOBAL DEFAULT UND abc