Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / combreloc.s
blob59dedceb633fc361a7d952ad0c25dd0de85d69c9
1 # REQUIRES: x86
3 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
4 # RUN: echo 'mov aaa@gotpcrel(%rip), %rax' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o
6 # RUN: ld.lld -shared %t.o %t1.o -o %t.so
7 # RUN: llvm-readobj -r --dynamic-table %t.so | FileCheck %s
8 # RUN: ld.lld -shared %t.o %t1.o -o %t.so -z combreloc
9 # RUN: llvm-readobj -r --dynamic-table %t.so | FileCheck %s
11 # -z combreloc is the default: sort relocations by (!IsRelative,SymIndex,r_offset),
12 # and emit DT_RELACOUNT (except on MIPS) to indicate the number of relative
13 # relocations.
15 # CHECK: DynamicSection [
16 # CHECK: RELACOUNT 1
17 # CHECK: Relocations [
18 # CHECK-NEXT: Section ({{.*}}) .rela.dyn {
19 # CHECK-NEXT: 0x3428 R_X86_64_RELATIVE - 0x3430
20 # CHECK-NEXT: 0x2400 R_X86_64_GLOB_DAT aaa 0x0
21 # CHECK-NEXT: 0x3408 R_X86_64_64 aaa 0x0
22 # CHECK-NEXT: 0x3420 R_X86_64_64 aaa 0x0
23 # CHECK-NEXT: 0x3418 R_X86_64_64 bbb 0x0
24 # CHECK-NEXT: 0x3410 R_X86_64_64 ccc 0x0
25 # CHECK-NEXT: }
27 # RUN: ld.lld -z nocombreloc -shared %t.o %t1.o -o %t.so
28 # RUN: llvm-readobj -r --dynamic-table %t.so | FileCheck --check-prefix=NOCOMB %s
30 # NOCOMB: DynamicSection [
31 # NOCOMB-NOT: RELACOUNT
32 # NOCOMB: Relocations [
33 # NOCOMB-NEXT: Section ({{.*}}) .rela.dyn {
34 # NOCOMB-NEXT: 0x33F8 R_X86_64_64 aaa 0x0
35 # NOCOMB-NEXT: 0x3400 R_X86_64_64 ccc 0x0
36 # NOCOMB-NEXT: 0x3408 R_X86_64_64 bbb 0x0
37 # NOCOMB-NEXT: 0x3410 R_X86_64_64 aaa 0x0
38 # NOCOMB-NEXT: 0x23F0 R_X86_64_GLOB_DAT aaa 0x0
39 # NOCOMB-NEXT: 0x3418 R_X86_64_RELATIVE - 0x3420
40 # NOCOMB-NEXT: }
42 .globl aaa, bbb, ccc
43 .data
44 .quad aaa
45 .quad ccc
46 .quad bbb
47 .quad aaa
48 .quad relative
49 relative: