2018-06-06 21:56:51 +08:00
|
|
|
// REQUIRES: x86
|
2016-03-17 13:57:33 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
|
2017-10-06 17:37:44 +08:00
|
|
|
// RUN: ld.lld --hash-style=sysv %t.o -o %t -pie
|
2020-03-04 11:49:14 +08:00
|
|
|
// RUN: llvm-readobj -S -d -r %t | FileCheck %s
|
2016-03-17 13:57:33 +08:00
|
|
|
// RUN: llvm-objdump -d %t | FileCheck --check-prefix=DISASM %s
|
|
|
|
|
|
|
|
.globl _start
|
|
|
|
_start:
|
|
|
|
call foo@gotpcrel
|
|
|
|
|
|
|
|
.hidden foo
|
|
|
|
.global foo
|
|
|
|
foo:
|
|
|
|
nop
|
|
|
|
|
2019-09-16 15:05:34 +08:00
|
|
|
// 0x22C8 - 0x1210 - 5 = 4275
|
2016-03-17 13:57:33 +08:00
|
|
|
// DISASM: Disassembly of section .text:
|
2019-05-01 18:40:48 +08:00
|
|
|
// DISASM-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
// DISASM-NEXT: <_start>:
|
2020-03-23 06:03:10 +08:00
|
|
|
// DISASM-NEXT: 1210: {{.*}} callq 0x22c8
|
2020-03-06 06:18:38 +08:00
|
|
|
// DISASM: <foo>:
|
2019-09-16 15:05:34 +08:00
|
|
|
// DISASM-NEXT: 1215: {{.*}} nop
|
2016-03-17 13:57:33 +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: 0x22C8
|
2016-03-17 13:57:33 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
|
|
|
// CHECK-NEXT: Size: 8
|
|
|
|
|
2020-03-04 11:49:14 +08:00
|
|
|
// CHECK: 0x000000006FFFFFF9 RELACOUNT 1
|
|
|
|
|
2016-03-17 13:57:33 +08:00
|
|
|
// CHECK: Relocations [
|
|
|
|
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
|
2019-09-16 15:05:34 +08:00
|
|
|
// CHECK-NEXT: 0x22C8 R_X86_64_RELATIVE - 0x1215
|
2016-03-17 13:57:33 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: ]
|