• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// REQUIRES: arm
2// RUN: llvm-mc -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o
3// RUN: ld.lld %t.o -o %t
4// RUN: llvm-objdump --triple=armv7a-none-linux-gnueabi -d --no-show-raw-insn %t | FileCheck %s --check-prefix=DISASM
5// RUN: llvm-readobj -r --symbols --sections %t | FileCheck %s
6 .syntax unified
7 .text
8 .type foo STT_GNU_IFUNC
9 .globl foo
10foo:
11 bx lr
12
13 .type bar STT_GNU_IFUNC
14 .globl bar
15bar:
16 bx lr
17
18 .globl _start
19_start:
20 bl foo
21 bl bar
22 movw r0,:lower16:__rel_iplt_start
23 movt r0,:upper16:__rel_iplt_start
24 movw r0,:lower16:__rel_iplt_end
25 movt r0,:upper16:__rel_iplt_end
26
27// CHECK: Sections [
28// CHECK:   Section {
29// CHECK:        Section {
30// CHECK:          Name: .rel.dyn
31// CHECK-NEXT:     Type: SHT_REL
32// CHECK-NEXT:     Flags [
33// CHECK-NEXT:       SHF_ALLOC
34// CHECK-NEXT:       SHF_INFO_LINK
35// CHECK-NEXT:     ]
36// CHECK-NEXT:     Address: 0x100F4
37// CHECK-NEXT:     Offset: 0xF4
38// CHECK-NEXT:     Size: 16
39// CHECK-NEXT:     Link:
40// CHECK-NEXT:     Info: 4
41// CHECK:          Name: .iplt
42// CHECK-NEXT:     Type: SHT_PROGBITS
43// CHECK-NEXT:     Flags [
44// CHECK-NEXT:       SHF_ALLOC
45// CHECK-NEXT:       SHF_EXECINSTR
46// CHECK-NEXT:     ]
47// CHECK-NEXT:     Address: 0x20130
48// CHECK-NEXT:     Offset: 0x130
49// CHECK-NEXT:     Size: 32
50// CHECK:          Index: 4
51// CHECK-NEXT:     Name: .got
52// CHECK-NEXT:     Type: SHT_PROGBITS
53// CHECK-NEXT:     Flags [
54// CHECK-NEXT:       SHF_ALLOC
55// CHECK-NEXT:       SHF_WRITE
56// CHECK-NEXT:     ]
57// CHECK-NEXT:     Address: 0x30150
58// CHECK-NEXT:     Offset: 0x150
59// CHECK-NEXT:     Size: 8
60// CHECK:      Relocations [
61// CHECK-NEXT:   Section (1) .rel.dyn {
62// CHECK-NEXT:     0x30150 R_ARM_IRELATIVE
63// CHECK-NEXT:     0x30154 R_ARM_IRELATIVE
64// CHECK-NEXT:   }
65// CHECK-NEXT: ]
66// CHECK:        Symbol {
67// CHECK:          Name: __rel_iplt_end
68// CHECK-NEXT:     Value: 0x10104
69// CHECK-NEXT:     Size: 0
70// CHECK-NEXT:     Binding: Local
71// CHECK-NEXT:     Type: None
72// CHECK-NEXT:     Other [
73// CHECK-NEXT:       STV_HIDDEN
74// CHECK-NEXT:     ]
75// CHECK-NEXT:     Section: .rel.dyn
76// CHECK-NEXT:   }
77// CHECK-NEXT:   Symbol {
78// CHECK-NEXT:     Name: __rel_iplt_start
79// CHECK-NEXT:     Value: 0x100F4
80// CHECK-NEXT:     Size: 0
81// CHECK-NEXT:     Binding: Local
82// CHECK-NEXT:     Type: None
83// CHECK-NEXT:     Other [
84// CHECK-NEXT:       STV_HIDDEN
85// CHECK-NEXT:     ]
86// CHECK-NEXT:     Section: .rel.dyn
87// CHECK-NEXT:   }
88// CHECK-NEXT:  Symbol {
89// CHECK-NEXT:    Name: _start
90// CHECK-NEXT:    Value: 0x2010C
91// CHECK-NEXT:    Size: 0
92// CHECK-NEXT:    Binding: Global
93// CHECK-NEXT:    Type: None
94// CHECK-NEXT:    Other:
95// CHECK-NEXT:    Section: .text
96// CHECK-NEXT:  }
97// CHECK-NEXT:  Symbol {
98// CHECK-NEXT:    Name: bar
99// CHECK-NEXT:    Value: 0x20108
100// CHECK-NEXT:    Size: 0
101// CHECK-NEXT:    Binding: Global
102// CHECK-NEXT:    Type: GNU_IFunc
103// CHECK-NEXT:    Other: 0
104// CHECK-NEXT:    Section: .text
105// CHECK-NEXT:  }
106// CHECK-NEXT:  Symbol {
107// CHECK-NEXT:    Name: foo
108// CHECK-NEXT:    Value: 0x20104
109// CHECK-NEXT:    Size: 0
110// CHECK-NEXT:    Binding: Global
111// CHECK-NEXT:    Type: GNU_IFunc
112// CHECK-NEXT:    Other: 0
113// CHECK-NEXT:    Section: .text
114// CHECK-NEXT:  }
115
116// DISASM: Disassembly of section .text:
117// DISASM-EMPTY:
118// DISASM-NEXT: <foo>:
119// DISASM-NEXT:    20104:      bx      lr
120// DISASM: <bar>:
121// DISASM-NEXT:    20108:      bx      lr
122// DISASM: <_start>:
123// DISASM-NEXT:    2010c:      bl      #28
124// DISASM-NEXT:    20110:      bl      #40
125// 1 * 65536 + 244 = 0x100f4 __rel_iplt_start
126// DISASM-NEXT:    20114:      movw    r0, #244
127// DISASM-NEXT:    20118:      movt    r0, #1
128// 1 * 65536 + 260 = 0x10104 __rel_iplt_end
129// DISASM-NEXT:    2011c:      movw    r0, #260
130// DISASM-NEXT:    20120:      movt    r0, #1
131// DISASM-EMPTY:
132// DISASM-NEXT: Disassembly of section .iplt:
133// DISASM-EMPTY:
134// DISASM-NEXT: <$a>:
135// DISASM-NEXT:    20130:       add     r12, pc, #0, #12
136// DISASM-NEXT:    20134:       add     r12, r12, #16
137// DISASM-NEXT:    20138:       ldr     pc, [r12, #24]!
138// DISASM: <$d>:
139// DISASM-NEXT:    2013c:       d4 d4 d4 d4     .word   0xd4d4d4d4
140// DISASM: <$a>:
141// DISASM-NEXT:    20140:       add     r12, pc, #0, #12
142// DISASM-NEXT:    20144:       add     r12, r12, #16
143// DISASM-NEXT:    20148:       ldr     pc, [r12, #12]!
144// DISASM: <$d>:
145// DISASM-NEXT:    2014c:       d4 d4 d4 d4     .word   0xd4d4d4d4
146
147