2015-11-24 14:48:31 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %t.o
|
|
|
|
// RUN: ld.lld -shared %t.o -o %t.so
|
|
|
|
// RUN: llvm-readobj -s -r %t.so | FileCheck %s
|
|
|
|
// RUN: llvm-objdump -d %t.so | FileCheck --check-prefix=DISASM %s
|
|
|
|
// REQUIRES: aarch64
|
|
|
|
|
|
|
|
// CHECK: Name: .got
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: SHF_WRITE
|
|
|
|
// CHECK-NEXT: ]
|
2017-01-10 09:21:30 +08:00
|
|
|
// CHECK-NEXT: Address: 0x30090
|
2015-11-24 14:48:31 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
|
|
|
// CHECK-NEXT: Size: 8
|
|
|
|
// CHECK-NEXT: Link: 0
|
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
// CHECK-NEXT: AddressAlignment: 8
|
|
|
|
|
|
|
|
// CHECK: Relocations [
|
|
|
|
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
|
2017-01-10 09:21:30 +08:00
|
|
|
// CHECK-NEXT: 0x30090 R_AARCH64_GLOB_DAT dat 0x0
|
2015-11-24 14:48:31 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
|
2016-10-04 16:58:55 +08:00
|
|
|
// Page(0x20098) - Page(0x10000) = 0x10000 = 65536
|
|
|
|
// 0x20098 & 0xff8 = 0x98 = 152
|
2015-11-24 14:48:31 +08:00
|
|
|
|
|
|
|
// DISASM: main:
|
2017-01-10 09:21:30 +08:00
|
|
|
// DISASM-NEXT: 10000: 00 01 00 90 adrp x0, #131072
|
2016-10-04 16:58:55 +08:00
|
|
|
// DISASM-NEXT: 10004: 00 48 40 f9 ldr x0, [x0, #144]
|
2015-11-24 14:48:31 +08:00
|
|
|
|
|
|
|
.global main,foo,dat
|
|
|
|
.text
|
|
|
|
main:
|
|
|
|
adrp x0, :got:dat
|
|
|
|
ldr x0, [x0, :got_lo12:dat]
|
|
|
|
.data
|
|
|
|
dat:
|
|
|
|
.word 42
|