forked from OSchip/llvm-project
144 lines
3.8 KiB
ArmAsm
144 lines
3.8 KiB
ArmAsm
// REQUIRES: aarch64
|
|
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o
|
|
// RUN: ld.lld -static %t.o -o %tout
|
|
// RUN: llvm-objdump -d --no-show-raw-insn %tout | FileCheck %s --check-prefix=DISASM
|
|
// RUN: llvm-readobj -r --symbols --sections %tout | FileCheck %s
|
|
|
|
// CHECK: Sections [
|
|
// CHECK: Section {
|
|
// CHECK: Index: 1
|
|
// CHECK-NEXT: Name: .rela.dyn
|
|
// CHECK-NEXT: Type: SHT_RELA
|
|
// CHECK-NEXT: Flags [
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
// CHECK-NEXT: SHF_INFO_LINK
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: Address: [[RELA:.*]]
|
|
// CHECK-NEXT: Offset: 0x158
|
|
// CHECK-NEXT: Size: 48
|
|
// CHECK-NEXT: Link: 0
|
|
// CHECK-NEXT: Info: 4
|
|
// CHECK-NEXT: AddressAlignment: 8
|
|
// CHECK-NEXT: EntrySize: 24
|
|
// CHECK-NEXT: }
|
|
// CHECK: Relocations [
|
|
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
|
|
// CHECK-NEXT: 0x2201C0 R_AARCH64_IRELATIVE
|
|
// CHECK-NEXT: 0x2201C8 R_AARCH64_IRELATIVE
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
// CHECK: Symbols [
|
|
// CHECK-NEXT: Symbol {
|
|
// CHECK-NEXT: Name:
|
|
// CHECK-NEXT: Value: 0x0
|
|
// CHECK-NEXT: Size: 0
|
|
// CHECK-NEXT: Binding: Local
|
|
// CHECK-NEXT: Type: None
|
|
// CHECK-NEXT: Other: 0
|
|
// CHECK-NEXT: Section: Undefined
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: Symbol {
|
|
// CHECK-NEXT: Name: $x.0
|
|
// CHECK-NEXT: Value: 0x210188
|
|
// CHECK-NEXT: Size: 0
|
|
// CHECK-NEXT: Binding: Local
|
|
// CHECK-NEXT: Type: None
|
|
// CHECK-NEXT: Other: 0
|
|
// CHECK-NEXT: Section: .text
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: Symbol {
|
|
// CHECK-NEXT: Name: __rela_iplt_start
|
|
// CHECK-NEXT: Value: 0x200158
|
|
// CHECK-NEXT: Size: 0
|
|
// CHECK-NEXT: Binding: Local
|
|
// CHECK-NEXT: Type: None
|
|
// CHECK-NEXT: Other [
|
|
// CHECK-NEXT: STV_HIDDEN
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: Section: .rela.dyn
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: Symbol {
|
|
// CHECK-NEXT: Name: __rela_iplt_end
|
|
// CHECK-NEXT: Value: 0x200188
|
|
// CHECK-NEXT: Size: 0
|
|
// CHECK-NEXT: Binding: Local
|
|
// CHECK-NEXT: Type: None
|
|
// CHECK-NEXT: Other [
|
|
// CHECK-NEXT: STV_HIDDEN
|
|
// CHECK-NEXT: ]
|
|
// CHECK-NEXT: Section: .rela.dyn
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: Symbol {
|
|
// CHECK-NEXT: Name: foo
|
|
// CHECK-NEXT: Value: 0x210188
|
|
// CHECK-NEXT: Size: 0
|
|
// CHECK-NEXT: Binding: Global
|
|
// CHECK-NEXT: Type: GNU_IFunc
|
|
// CHECK-NEXT: Other: 0
|
|
// CHECK-NEXT: Section: .text
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: Symbol {
|
|
// CHECK-NEXT: Name: bar
|
|
// CHECK-NEXT: Value: 0x21018C
|
|
// CHECK-NEXT: Size: 0
|
|
// CHECK-NEXT: Binding: Global
|
|
// CHECK-NEXT: Type: GNU_IFunc
|
|
// CHECK-NEXT: Other: 0
|
|
// CHECK-NEXT: Section: .text
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: Symbol {
|
|
// CHECK-NEXT: Name: _start
|
|
// CHECK-NEXT: Value: 0x210190
|
|
// CHECK-NEXT: Size: 0
|
|
// CHECK-NEXT: Binding: Global
|
|
// CHECK-NEXT: Type: None
|
|
// CHECK-NEXT: Other: 0
|
|
// CHECK-NEXT: Section: .text
|
|
// CHECK-NEXT: }
|
|
// CHECK-NEXT: ]
|
|
|
|
// 344 = 0x158
|
|
// 392 = 0x188
|
|
|
|
// DISASM: Disassembly of section .text:
|
|
// DISASM-EMPTY:
|
|
// DISASM-NEXT: <foo>:
|
|
// DISASM-NEXT: 210188: ret
|
|
// DISASM: <bar>:
|
|
// DISASM-NEXT: 21018c: ret
|
|
// DISASM: <_start>:
|
|
// DISASM-NEXT: 210190: bl 0x2101a0
|
|
// DISASM-NEXT: 210194: bl 0x2101b0
|
|
// DISASM-NEXT: 210198: add x2, x2, #344
|
|
// DISASM-NEXT: 21019c: add x2, x2, #392
|
|
// DISASM-EMPTY:
|
|
// DISASM-NEXT: Disassembly of section .iplt:
|
|
// DISASM-EMPTY:
|
|
// DISASM-NEXT: <.iplt>:
|
|
// DISASM-NEXT: 2101a0: adrp x16, 0x220000
|
|
// DISASM-NEXT: 2101a4: ldr x17, [x16, #448]
|
|
// DISASM-NEXT: 2101a8: add x16, x16, #448
|
|
// DISASM-NEXT: 2101ac: br x17
|
|
// DISASM-NEXT: 2101b0: adrp x16, 0x220000
|
|
// DISASM-NEXT: 2101b4: ldr x17, [x16, #456]
|
|
// DISASM-NEXT: 2101b8: add x16, x16, #456
|
|
// DISASM-NEXT: 2101bc: br x17
|
|
|
|
.text
|
|
.type foo STT_GNU_IFUNC
|
|
.globl foo
|
|
foo:
|
|
ret
|
|
|
|
.type bar STT_GNU_IFUNC
|
|
.globl bar
|
|
bar:
|
|
ret
|
|
|
|
.globl _start
|
|
_start:
|
|
bl foo
|
|
bl bar
|
|
add x2, x2, :lo12:__rela_iplt_start
|
|
add x2, x2, :lo12:__rela_iplt_end
|