[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / aarch64-gnu-ifunc.s
blobf2956a63e2cd49632cac6657122c998e9cabefac
1 // REQUIRES: aarch64
2 // RUN: llvm-mc -filetype=obj -triple=aarch64 %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: .rela.dyn
11 // CHECK-NEXT: Type: SHT_RELA
12 // CHECK-NEXT: Flags [
13 // CHECK-NEXT: SHF_ALLOC
14 // CHECK-NEXT: ]
15 // CHECK-NEXT: Address: [[RELA:.*]]
16 // CHECK-NEXT: Offset: 0x158
17 // CHECK-NEXT: Size: 48
18 // CHECK-NEXT: Link: 0
19 // CHECK-NEXT: Info: 0
20 // CHECK-NEXT: AddressAlignment: 8
21 // CHECK-NEXT: EntrySize: 24
22 // CHECK-NEXT: }
23 // CHECK: Relocations [
24 // CHECK-NEXT: Section ({{.*}}) .rela.dyn {
25 // CHECK-NEXT: 0x2201C0 R_AARCH64_IRELATIVE
26 // CHECK-NEXT: 0x2201C8 R_AARCH64_IRELATIVE
27 // CHECK-NEXT: }
28 // CHECK-NEXT: ]
29 // CHECK: 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: $x
41 // CHECK-NEXT: Value: 0x210188
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: __rela_iplt_start
50 // CHECK-NEXT: Value: 0x200158
51 // CHECK-NEXT: Size: 0
52 // CHECK-NEXT: Binding: Local
53 // CHECK-NEXT: Type: None
54 // CHECK-NEXT: Other [
55 // CHECK-NEXT: STV_HIDDEN
56 // CHECK-NEXT: ]
57 // CHECK-NEXT: Section: .rela.dyn
58 // CHECK-NEXT: }
59 // CHECK-NEXT: Symbol {
60 // CHECK-NEXT: Name: __rela_iplt_end
61 // CHECK-NEXT: Value: 0x200188
62 // CHECK-NEXT: Size: 0
63 // CHECK-NEXT: Binding: Local
64 // CHECK-NEXT: Type: None
65 // CHECK-NEXT: Other [
66 // CHECK-NEXT: STV_HIDDEN
67 // CHECK-NEXT: ]
68 // CHECK-NEXT: Section: .rela.dyn
69 // CHECK-NEXT: }
70 // CHECK-NEXT: Symbol {
71 // CHECK-NEXT: Name: foo
72 // CHECK-NEXT: Value: 0x210188
73 // CHECK-NEXT: Size: 0
74 // CHECK-NEXT: Binding: Global
75 // CHECK-NEXT: Type: GNU_IFunc
76 // CHECK-NEXT: Other: 0
77 // CHECK-NEXT: Section: .text
78 // CHECK-NEXT: }
79 // CHECK-NEXT: Symbol {
80 // CHECK-NEXT: Name: bar
81 // CHECK-NEXT: Value: 0x21018C
82 // CHECK-NEXT: Size: 0
83 // CHECK-NEXT: Binding: Global
84 // CHECK-NEXT: Type: GNU_IFunc
85 // CHECK-NEXT: Other: 0
86 // CHECK-NEXT: Section: .text
87 // CHECK-NEXT: }
88 // CHECK-NEXT: Symbol {
89 // CHECK-NEXT: Name: _start
90 // CHECK-NEXT: Value: 0x210190
91 // CHECK-NEXT: Size: 0
92 // CHECK-NEXT: Binding: Global
93 // CHECK-NEXT: Type: None
94 // CHECK-NEXT: Other: 0
95 // CHECK-NEXT: Section: .text
96 // CHECK-NEXT: }
97 // CHECK-NEXT: ]
99 // 344 = 0x158
100 // 392 = 0x188
102 // DISASM: Disassembly of section .text:
103 // DISASM-EMPTY:
104 // DISASM-NEXT: <foo>:
105 // DISASM-NEXT: 210188: ret
106 // DISASM: <bar>:
107 // DISASM-NEXT: 21018c: ret
108 // DISASM: <_start>:
109 // DISASM-NEXT: 210190: bl 0x2101a0
110 // DISASM-NEXT: 210194: bl 0x2101b0
111 // DISASM-NEXT: 210198: add x2, x2, #344
112 // DISASM-NEXT: 21019c: add x2, x2, #392
113 // DISASM-EMPTY:
114 // DISASM-NEXT: Disassembly of section .iplt:
115 // DISASM-EMPTY:
116 // DISASM-NEXT: <.iplt>:
117 // DISASM-NEXT: 2101a0: adrp x16, 0x220000
118 // DISASM-NEXT: 2101a4: ldr x17, [x16, #448]
119 // DISASM-NEXT: 2101a8: add x16, x16, #448
120 // DISASM-NEXT: 2101ac: br x17
121 // DISASM-NEXT: 2101b0: adrp x16, 0x220000
122 // DISASM-NEXT: 2101b4: ldr x17, [x16, #456]
123 // DISASM-NEXT: 2101b8: add x16, x16, #456
124 // DISASM-NEXT: 2101bc: br x17
126 .text
127 .type foo STT_GNU_IFUNC
128 .globl foo
129 foo:
132 .type bar STT_GNU_IFUNC
133 .globl bar
134 bar:
137 .globl _start
138 _start:
139 bl foo
140 bl bar
141 add x2, x2, :lo12:__rela_iplt_start
142 add x2, x2, :lo12:__rela_iplt_end