2018-06-27 06:20:04 +08:00
|
|
|
// REQUIRES: x86
|
2015-12-21 18:12:06 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
|
|
|
// RUN: ld.lld -static %t.o -o %tout
|
|
|
|
// RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DISASM
|
2019-05-01 13:49:01 +08:00
|
|
|
// RUN: llvm-readobj -r --symbols --sections %tout | FileCheck %s
|
2015-12-21 18:12:06 +08:00
|
|
|
|
|
|
|
// CHECK: Sections [
|
|
|
|
// CHECK: Section {
|
|
|
|
// CHECK: Index: 1
|
2019-08-03 10:26:52 +08:00
|
|
|
// CHECK-NEXT: Name: .rela.dyn
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: Type: SHT_RELA
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
// CHECK-NEXT: Address: [[RELA:.*]]
|
|
|
|
// CHECK-NEXT: Offset: 0x158
|
|
|
|
// CHECK-NEXT: Size: 48
|
2018-11-02 06:28:58 +08:00
|
|
|
// CHECK-NEXT: Link: 0
|
2018-10-11 16:25:35 +08:00
|
|
|
// CHECK-NEXT: Info: [[GOTPLT:.*]]
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: AddressAlignment: 8
|
|
|
|
// CHECK-NEXT: EntrySize: 24
|
|
|
|
// CHECK-NEXT: }
|
2018-10-11 16:25:35 +08:00
|
|
|
// CHECK: Index: [[GOTPLT]]
|
|
|
|
// CHECK-NEXT: Name: .got.plt
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK: Relocations [
|
2019-08-03 10:26:52 +08:00
|
|
|
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
|
2019-09-16 15:05:34 +08:00
|
|
|
// CHECK-NEXT: 0x2021D0 R_X86_64_IRELATIVE
|
|
|
|
// CHECK-NEXT: 0x2021D8 R_X86_64_IRELATIVE
|
2015-12-21 18:12:06 +08:00
|
|
|
// 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: __rela_iplt_end
|
2016-11-24 01:44:02 +08:00
|
|
|
// CHECK-NEXT: Value: 0x200188
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Local
|
|
|
|
// CHECK-NEXT: Type: None
|
2016-04-04 22:04:16 +08:00
|
|
|
// CHECK-NEXT: Other [
|
|
|
|
// CHECK-NEXT: STV_HIDDEN
|
|
|
|
// CHECK-NEXT: ]
|
2019-08-03 10:26:52 +08:00
|
|
|
// CHECK-NEXT: Section: .rela.dyn
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: __rela_iplt_start
|
|
|
|
// CHECK-NEXT: Value: [[RELA]]
|
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Local
|
|
|
|
// CHECK-NEXT: Type: None
|
2016-04-04 22:04:16 +08:00
|
|
|
// CHECK-NEXT: Other [
|
|
|
|
// CHECK-NEXT: STV_HIDDEN
|
|
|
|
// CHECK-NEXT: ]
|
2019-08-03 10:26:52 +08:00
|
|
|
// CHECK-NEXT: Section: .rela.dyn
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: _start
|
2019-09-16 15:05:34 +08:00
|
|
|
// CHECK-NEXT: Value: 0x20118A
|
2015-12-21 18:12:06 +08:00
|
|
|
// CHECK-NEXT: Size: 0
|
|
|
|
// CHECK-NEXT: Binding: Global
|
|
|
|
// CHECK-NEXT: Type: None
|
|
|
|
// CHECK-NEXT: Other: 0
|
|
|
|
// CHECK-NEXT: Section: .text
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: Symbol {
|
|
|
|
// CHECK-NEXT: Name: bar
|
2019-09-16 15:05:34 +08:00
|
|
|
// CHECK-NEXT: Value: 0x201189
|
2015-12-21 18:12:06 +08:00
|
|
|
// 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: foo
|
2019-09-16 15:05:34 +08:00
|
|
|
// CHECK-NEXT: Value: 0x201188
|
2015-12-21 18:12:06 +08:00
|
|
|
// 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: ]
|
|
|
|
|
2016-12-08 20:58:55 +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: <foo>:
|
2019-09-16 15:05:34 +08:00
|
|
|
// DISASM-NEXT: 201188: {{.*}} retq
|
2020-03-06 06:18:38 +08:00
|
|
|
// DISASM: <bar>:
|
2019-09-16 15:05:34 +08:00
|
|
|
// DISASM-NEXT: 201189: {{.*}} retq
|
2020-03-06 06:18:38 +08:00
|
|
|
// DISASM: <_start>:
|
2020-03-23 06:03:10 +08:00
|
|
|
// DISASM-NEXT: 20118a: {{.*}} callq 0x2011b0
|
|
|
|
// DISASM-NEXT: 20118f: {{.*}} callq 0x2011c0
|
2019-09-16 15:05:34 +08:00
|
|
|
// DISASM-NEXT: 201194: {{.*}} movl $2097496, %edx
|
|
|
|
// DISASM-NEXT: 201199: {{.*}} movl $2097544, %edx
|
|
|
|
// DISASM-NEXT: 20119e: {{.*}} movl $2097545, %edx
|
2019-05-01 18:40:48 +08:00
|
|
|
// DISASM-EMPTY:
|
2019-12-15 08:19:03 +08:00
|
|
|
// DISASM-NEXT: Disassembly of section .iplt:
|
2019-05-01 18:40:48 +08:00
|
|
|
// DISASM-EMPTY:
|
2020-03-06 06:18:38 +08:00
|
|
|
// DISASM-NEXT: <.iplt>:
|
2019-09-16 15:05:34 +08:00
|
|
|
// DISASM-NEXT: 2011b0: {{.*}} jmpq *4122(%rip)
|
|
|
|
// DISASM-NEXT: 2011b6: {{.*}} pushq $0
|
2020-03-23 06:03:10 +08:00
|
|
|
// DISASM-NEXT: 2011bb: {{.*}} jmp 0x0
|
2019-09-16 15:05:34 +08:00
|
|
|
// DISASM-NEXT: 2011c0: {{.*}} jmpq *4114(%rip)
|
|
|
|
// DISASM-NEXT: 2011c6: {{.*}} pushq $1
|
2020-03-23 06:03:10 +08:00
|
|
|
// DISASM-NEXT: 2011cb: {{.*}} jmp 0x0
|
2015-12-21 18:12:06 +08:00
|
|
|
|
|
|
|
.text
|
|
|
|
.type foo STT_GNU_IFUNC
|
|
|
|
.globl foo
|
|
|
|
foo:
|
|
|
|
ret
|
|
|
|
|
|
|
|
.type bar STT_GNU_IFUNC
|
|
|
|
.globl bar
|
|
|
|
bar:
|
|
|
|
ret
|
|
|
|
|
|
|
|
.globl _start
|
|
|
|
_start:
|
|
|
|
call foo
|
|
|
|
call bar
|
|
|
|
movl $__rela_iplt_start,%edx
|
|
|
|
movl $__rela_iplt_end,%edx
|
2016-04-12 22:35:26 +08:00
|
|
|
movl $__rela_iplt_end + 1,%edx
|