Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / gnu-ifunc-i386.s
blobb502fd6e9ae2d513315cd122a76f1ef90bf126b1
1 // REQUIRES: x86
2 // RUN: llvm-mc -filetype=obj -triple=i686-pc-linux %s -o %t.o
3 // RUN: ld.lld -static %t.o -o %tout
4 // RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %tout | FileCheck %s --check-prefix=DISASM
5 // RUN: llvm-readobj -r --symbols --sections %tout | FileCheck %s
7 // CHECK: Sections [
8 // CHECK: Section {
9 // CHECK: Index: 1
10 // CHECK-NEXT: Name: .rel.dyn
11 // CHECK-NEXT: Type: SHT_REL
12 // CHECK-NEXT: Flags [
13 // CHECK-NEXT: SHF_ALLOC
14 // CHECK-NEXT: SHF_INFO_LINK
15 // CHECK-NEXT: ]
16 // CHECK-NEXT: Address: [[RELA:.*]]
17 // CHECK-NEXT: Offset: 0xD4
18 // CHECK-NEXT: Size: 16
19 // CHECK-NEXT: Link: 0
20 // CHECK-NEXT: Info: 4
21 // CHECK-NEXT: AddressAlignment: 4
22 // CHECK-NEXT: EntrySize: 8
23 // CHECK-NEXT: }
24 // CHECK: Relocations [
25 // CHECK-NEXT: Section ({{.*}}) .rel.dyn {
26 // CHECK-NEXT: 0x402120 R_386_IRELATIVE
27 // CHECK-NEXT: 0x402124 R_386_IRELATIVE
28 // CHECK-NEXT: }
29 // CHECK-NEXT: ]
31 // CHECK: Symbols [
32 // CHECK-NEXT: Symbol {
33 // CHECK-NEXT: Name:
34 // CHECK-NEXT: Value: 0x0
35 // CHECK-NEXT: Size: 0
36 // CHECK-NEXT: Binding: Local
37 // CHECK-NEXT: Type: None
38 // CHECK-NEXT: Other: 0
39 // CHECK-NEXT: Section: Undefined
40 // CHECK-NEXT: }
41 // CHECK-NEXT: Symbol {
42 // CHECK-NEXT: Name: __rel_iplt_start
43 // CHECK-NEXT: Value: [[RELA]]
44 // CHECK-NEXT: Size: 0
45 // CHECK-NEXT: Binding: Local
46 // CHECK-NEXT: Type: None
47 // CHECK-NEXT: Other [
48 // CHECK-NEXT: STV_HIDDEN
49 // CHECK-NEXT: ]
50 // CHECK-NEXT: Section: .rel.dyn
51 // CHECK-NEXT: }
52 // CHECK-NEXT: Symbol {
53 // CHECK-NEXT: Name: __rel_iplt_end
54 // CHECK-NEXT: Value: 0x4000E4
55 // CHECK-NEXT: Size: 0
56 // CHECK-NEXT: Binding: Local
57 // CHECK-NEXT: Type: None
58 // CHECK-NEXT: Other [
59 // CHECK-NEXT: STV_HIDDEN
60 // CHECK-NEXT: ]
61 // CHECK-NEXT: Section: .rel.dyn
62 // CHECK-NEXT: }
63 // CHECK-NEXT: Symbol {
64 // CHECK-NEXT: Name: bar
65 // CHECK-NEXT: Value: 0x401100
66 // CHECK-NEXT: Size: 0
67 // CHECK-NEXT: Binding: Global
68 // CHECK-NEXT: Type: Function
69 // CHECK-NEXT: Other: 0
70 // CHECK-NEXT: Section: .iplt
71 // CHECK-NEXT: }
72 // CHECK-NEXT: Symbol {
73 // CHECK-NEXT: Name: bar_resolver
74 // CHECK-NEXT: Value: 0x4010E4
75 // CHECK-NEXT: Size: 0
76 // CHECK-NEXT: Binding: Global
77 // CHECK-NEXT: Type: Function
78 // CHECK-NEXT: Other: 0
79 // CHECK-NEXT: Section: .text
80 // CHECK-NEXT: }
81 // CHECK-NEXT: Symbol {
82 // CHECK-NEXT: Name: foo
83 // CHECK-NEXT: Value: 0x401110
84 // CHECK-NEXT: Size: 0
85 // CHECK-NEXT: Binding: Global
86 // CHECK-NEXT: Type: Function
87 // CHECK-NEXT: Other: 0
88 // CHECK-NEXT: Section: .iplt
89 // CHECK-NEXT: }
90 // CHECK-NEXT: Symbol {
91 // CHECK-NEXT: Name: foo_resolver
92 // CHECK-NEXT: Value: 0x4010E5
93 // CHECK-NEXT: Size: 0
94 // CHECK-NEXT: Binding: Global
95 // CHECK-NEXT: Type: Function
96 // CHECK-NEXT: Other: 0
97 // CHECK-NEXT: Section: .text
98 // CHECK-NEXT: }
99 // CHECK-NEXT: Symbol {
100 // CHECK-NEXT: Name: _start
101 // CHECK-NEXT: Value: 0x4010E6
102 // CHECK-NEXT: Size: 0
103 // CHECK-NEXT: Binding: Global
104 // CHECK-NEXT: Type: None
105 // CHECK-NEXT: Other: 0
106 // CHECK-NEXT: Section: .text
107 // CHECK-NEXT: }
108 // CHECK-NEXT:]
110 // DISASM: Disassembly of section .text:
111 // DISASM-EMPTY:
112 // DISASM-NEXT: <bar_resolver>:
113 // DISASM-NEXT: 4010e4: retl
114 // DISASM: <foo_resolver>:
115 // DISASM-NEXT: 4010e5: retl
116 // DISASM: <_start>:
117 // DISASM-NEXT: 4010e6: calll 0x401110 <foo>
118 // DISASM-NEXT: calll 0x401100 <bar>
119 // DISASM-NEXT: movl $4194516, %edx
120 // DISASM-NEXT: movl $4194532, %edx
121 // DISASM-EMPTY:
122 // DISASM-NEXT: Disassembly of section .iplt:
123 // DISASM-EMPTY:
124 // DISASM-NEXT: <bar>:
125 // DISASM-NEXT: 401100: jmpl *4202784
126 // DISASM-NEXT: pushl $0
127 // DISASM-NEXT: jmp 0x0
128 // DISASM: <foo>:
129 // DISASM-NEXT: 401110: jmpl *4202788
130 // DISASM-NEXT: pushl $8
131 // DISASM-NEXT: jmp 0x0
133 .type bar STT_GNU_IFUNC
134 .globl bar
135 bar:
136 .type bar_resolver STT_FUNC
137 .globl bar_resolver
138 bar_resolver:
141 .text
142 .type foo STT_GNU_IFUNC
143 .globl foo
144 foo:
145 .type foo_resolver STT_FUNC
146 .globl foo_resolver
147 foo_resolver:
150 .globl _start
151 _start:
152 call foo
153 call bar
154 movl $__rel_iplt_start,%edx
155 movl $__rel_iplt_end,%edx