2015-09-16 23:54:15 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/shared.s -o %t2.o
|
2015-09-29 04:18:40 +08:00
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/dynamic-reloc.s -o %t3.o
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld -shared %t2.o -o %t2.so
|
|
|
|
// RUN: ld.lld %t.o %t3.o %t2.so -o %t
|
2015-09-17 02:52:42 +08:00
|
|
|
// RUN: llvm-readobj -dynamic-table -r --expand-relocs -s %t | FileCheck %s
|
2015-09-16 23:54:15 +08:00
|
|
|
// REQUIRES: x86
|
|
|
|
|
2015-10-02 05:15:02 +08:00
|
|
|
// CHECK: Index: 1
|
2015-09-16 23:54:15 +08:00
|
|
|
// CHECK-NEXT: Name: .dynsym
|
|
|
|
|
2015-10-29 02:33:08 +08:00
|
|
|
// CHECK: Name: .rela.plt
|
2015-09-16 23:54:15 +08:00
|
|
|
// CHECK-NEXT: Type: SHT_RELA
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: ]
|
2015-09-17 02:52:42 +08:00
|
|
|
// CHECK-NEXT: Address: [[RELAADDR:.*]]
|
2015-09-18 05:13:41 +08:00
|
|
|
// CHECK-NEXT: Offset:
|
2015-09-17 02:52:42 +08:00
|
|
|
// CHECK-NEXT: Size: [[RELASIZE:.*]]
|
2015-10-02 05:15:02 +08:00
|
|
|
// CHECK-NEXT: Link: 1
|
2015-09-16 23:54:15 +08:00
|
|
|
// CHECK-NEXT: Info: 0
|
|
|
|
// CHECK-NEXT: AddressAlignment: 8
|
|
|
|
// CHECK-NEXT: EntrySize: 24
|
|
|
|
|
2015-10-02 05:15:02 +08:00
|
|
|
// CHECK: Name: .text
|
|
|
|
// CHECK-NEXT: Type: SHT_PROGBITS
|
|
|
|
// CHECK-NEXT: Flags [
|
|
|
|
// CHECK-NEXT: SHF_ALLOC
|
|
|
|
// CHECK-NEXT: SHF_EXECINSTR
|
|
|
|
// CHECK-NEXT: ]
|
2015-10-29 02:33:08 +08:00
|
|
|
// CHECK-NEXT: Address: 0x11000
|
2015-10-02 05:15:02 +08:00
|
|
|
|
2015-09-16 23:54:15 +08:00
|
|
|
// CHECK: Relocations [
|
2015-10-29 02:33:08 +08:00
|
|
|
// CHECK-NEXT: Section ({{.*}}) .rela.plt {
|
2015-09-16 23:54:15 +08:00
|
|
|
// CHECK-NEXT: Relocation {
|
2015-12-23 23:20:38 +08:00
|
|
|
// CHECK-NEXT: Offset: 0x13018
|
2015-10-29 02:33:08 +08:00
|
|
|
// CHECK-NEXT: Type: R_X86_64_JUMP_SLOT
|
2015-09-16 23:54:15 +08:00
|
|
|
// CHECK-NEXT: Symbol: bar
|
2015-10-29 02:33:08 +08:00
|
|
|
// CHECK-NEXT: Addend: 0x0
|
2015-09-16 23:54:15 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
|
2015-09-17 02:52:42 +08:00
|
|
|
// CHECK: DynamicSection [
|
|
|
|
// CHECK-NEXT: Tag Type Name/Value
|
2016-01-29 09:24:25 +08:00
|
|
|
// CHECK-NEXT: 0x0000000000000001 NEEDED SharedLibrary ({{.*}}2.so)
|
2016-11-02 10:18:01 +08:00
|
|
|
// CHECK-NEXT: 0x0000000000000015 DEBUG 0x0
|
2015-10-29 02:33:08 +08:00
|
|
|
// CHECK-NEXT: 0x0000000000000017 JMPREL
|
|
|
|
// CHECK-NEXT: 0x0000000000000002 PLTRELSZ 24 (bytes)
|
|
|
|
// CHECK-NEXT: 0x0000000000000003 PLTGOT
|
|
|
|
// CHECK-NEXT: 0x0000000000000014 PLTREL RELA
|
2015-09-17 03:48:57 +08:00
|
|
|
// CHECK-NEXT: 0x0000000000000006 SYMTAB
|
2015-10-01 05:57:53 +08:00
|
|
|
// CHECK-NEXT: 0x000000000000000B SYMENT 24 (bytes)
|
2015-09-17 03:48:57 +08:00
|
|
|
// CHECK-NEXT: 0x0000000000000005 STRTAB
|
|
|
|
// CHECK-NEXT: 0x000000000000000A STRSZ
|
|
|
|
// CHECK-NEXT: 0x0000000000000004 HASH
|
2015-09-17 03:26:31 +08:00
|
|
|
// CHECK-NEXT: 0x0000000000000000 NULL 0x0
|
|
|
|
// CHECK-NEXT: ]
|
|
|
|
|
2015-09-16 23:54:15 +08:00
|
|
|
.global _start
|
|
|
|
_start:
|
|
|
|
.quad bar + 0x42
|
2015-10-07 12:22:55 +08:00
|
|
|
.weak foo
|
|
|
|
.quad foo
|
2015-09-29 04:18:40 +08:00
|
|
|
call main
|