Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / emit-relocs.s
blobd7cfcc165299e4df05790c4d9e6929f055faa639
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o
3 # RUN: ld.lld --emit-relocs %t1.o -o %t
4 # RUN: llvm-readobj --symbols -r -S %t | FileCheck %s
6 ## Check single dash form.
7 # RUN: ld.lld -emit-relocs %t1.o -o %t1
8 # RUN: llvm-readobj --symbols -r -S %t1 | FileCheck %s
10 ## Check alias.
11 # RUN: ld.lld -q %t1.o -o %t2
12 # RUN: llvm-readobj --symbols -r -S %t2 | FileCheck %s
14 # CHECK: Section {
15 # CHECK: Index: 2
16 # CHECK: Name: .rela.text
17 # CHECK-NEXT: Type: SHT_RELA
18 # CHECK-NEXT: Flags [
19 # CHECK-NEXT: SHF_INFO_LINK
20 # CHECK-NEXT: ]
21 # CHECK: Relocations [
22 # CHECK-NEXT: Section ({{.*}}) .rela.text {
23 # CHECK-NEXT: 0x201122 R_X86_64_32 .text 0x1
24 # CHECK-NEXT: 0x201127 R_X86_64_PLT32 fn 0xFFFFFFFFFFFFFFFC
25 # CHECK-NEXT: 0x20112E R_X86_64_32 .text 0xD
26 # CHECK-NEXT: 0x201133 R_X86_64_PLT32 fn2 0xFFFFFFFFFFFFFFFC
27 # CHECK-NEXT: }
28 # CHECK-NEXT: ]
29 # CHECK-NEXT: Symbols [
30 # CHECK-NEXT: Symbol {
31 # CHECK-NEXT: Name:
32 # CHECK-NEXT: Value: 0x0
33 # CHECK-NEXT: Size: 0
34 # CHECK-NEXT: Binding: Local
35 # CHECK-NEXT: Type: None
36 # CHECK-NEXT: Other: 0
37 # CHECK-NEXT: Section: Undefined
38 # CHECK-NEXT: }
39 # CHECK-NEXT: Symbol {
40 # CHECK-NEXT: Name: bar
41 # CHECK-NEXT: Value: 0x201121
42 # CHECK-NEXT: Size: 0
43 # CHECK-NEXT: Binding: Local
44 # CHECK-NEXT: Type: None
45 # CHECK-NEXT: Other: 0
46 # CHECK-NEXT: Section: .text
47 # CHECK-NEXT: }
48 # CHECK-NEXT: Symbol {
49 # CHECK-NEXT: Name: foo
50 # CHECK-NEXT: Value: 0x20112D
51 # CHECK-NEXT: Size: 0
52 # CHECK-NEXT: Binding: Local
53 # CHECK-NEXT: Type: None
54 # CHECK-NEXT: Other: 0
55 # CHECK-NEXT: Section: .text
56 # CHECK-NEXT: }
57 # CHECK-NEXT: Symbol {
58 # CHECK-NEXT: Name:
59 # CHECK-NEXT: Value: 0x201120
60 # CHECK-NEXT: Size: 0
61 # CHECK-NEXT: Binding: Local
62 # CHECK-NEXT: Type: Section
63 # CHECK-NEXT: Other: 0
64 # CHECK-NEXT: Section: .text
65 # CHECK-NEXT: }
66 # CHECK-NEXT: Symbol {
67 # CHECK-NEXT: Name:
68 # CHECK-NEXT: Value: 0x0
69 # CHECK-NEXT: Size: 0
70 # CHECK-NEXT: Binding: Local
71 # CHECK-NEXT: Type: Section
72 # CHECK-NEXT: Other: 0
73 # CHECK-NEXT: Section: .comment
74 # CHECK-NEXT: }
75 # CHECK-NEXT: Symbol {
76 # CHECK-NEXT: Name: fn
77 # CHECK-NEXT: Value: 0x201120
78 # CHECK-NEXT: Size: 0
79 # CHECK-NEXT: Binding: Global
80 # CHECK-NEXT: Type: Function
81 # CHECK-NEXT: Other: 0
82 # CHECK-NEXT: Section: .text
83 # CHECK-NEXT: }
84 # CHECK-NEXT: Symbol {
85 # CHECK-NEXT: Name: fn2
86 # CHECK-NEXT: Value: 0x20112C
87 # CHECK-NEXT: Size: 0
88 # CHECK-NEXT: Binding: Global
89 # CHECK-NEXT: Type: Function
90 # CHECK-NEXT: Other: 0
91 # CHECK-NEXT: Section: .text
92 # CHECK-NEXT: }
93 # CHECK-NEXT: ]
95 .section .text.fn,"ax",@progbits,unique,0
96 .globl fn
97 .type fn,@function
98 fn:
99 nop
101 bar:
102 movl $bar, %edx
103 callq fn@PLT
106 .section .text.fn2,"ax",@progbits,unique,1
107 .globl fn2
108 .type fn2,@function
109 fn2:
112 foo:
113 movl $foo, %edx
114 callq fn2@PLT