2018-06-06 21:56:51 +08:00
|
|
|
// REQUIRES: x86
|
2015-10-07 08:58:20 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
|
2019-09-10 20:28:07 +08:00
|
|
|
// RUN: ld.lld %t.o -o %t -shared
|
2020-03-04 11:49:14 +08:00
|
|
|
// RUN: llvm-readobj -S -d -r %t | FileCheck %s
|
2019-09-10 20:28:07 +08:00
|
|
|
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=DISASM %s
|
2015-10-07 08:58:20 +08:00
|
|
|
|
|
|
|
bar:
|
|
|
|
call foo@gotpcrel
|
|
|
|
|
|
|
|
.hidden foo
|
|
|
|
.global foo
|
|
|
|
foo:
|
|
|
|
nop
|
|
|
|
|
2019-09-16 15:05:34 +08:00
|
|
|
// 0x22E0 - 0x1228 - 5 = 4275
|
2020-03-06 06:18:38 +08:00
|
|
|
// DISASM: <bar>:
|
2020-03-23 06:03:10 +08:00
|
|
|
// DISASM-NEXT: 1228: callq 0x22e0
|
2015-10-07 08:58:20 +08:00
|
|
|
|
2020-03-06 06:18:38 +08:00
|
|
|
// DISASM: <foo>:
|
2019-09-16 15:05:34 +08:00
|
|
|
// DISASM-NEXT: 122d: nop
|
2015-10-07 08:58:20 +08:00
|
|
|
|
|
|
|
// CHECK: Name: .got
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: SHF_WRITE
|
|
|
|
// CHECK-NEXT: ]
|
2019-09-16 15:05:34 +08:00
|
|
|
// CHECK-NEXT: Address: 0x22E0
|
2015-10-07 08:58:20 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
|
|
|
// CHECK-NEXT: Size: 8
|
|
|
|
|
2020-03-04 11:49:14 +08:00
|
|
|
// CHECK: 0x000000006FFFFFF9 RELACOUNT 1
|
|
|
|
|
2015-10-07 08:58:20 +08:00
|
|
|
// CHECK: Relocations [
|
|
|
|
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
|
2019-09-16 15:05:34 +08:00
|
|
|
// CHECK-NEXT: 0x22E0 R_X86_64_RELATIVE - 0x122D
|
2015-10-07 08:58:20 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: ]
|