2015-10-16 01:11:03 +08:00
|
|
|
// REQUIRES: x86
|
|
|
|
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
|
2015-11-18 14:11:01 +08:00
|
|
|
// RUN: ld.lld %t -o %tout -shared
|
2015-10-16 01:11:03 +08:00
|
|
|
// RUN: llvm-objdump -d %tout | FileCheck -check-prefix=DISASM %s
|
2015-10-19 23:21:42 +08:00
|
|
|
// RUN: llvm-readobj -symbols -r %tout | FileCheck -check-prefix=SYMBOL %s
|
2015-10-16 01:11:03 +08:00
|
|
|
|
|
|
|
// DISASM: _start:
|
2015-10-19 23:21:42 +08:00
|
|
|
// DISASM: 1000: {{.*}} callq 10
|
|
|
|
// DISASM: 1005: {{.*}} callq 8
|
|
|
|
// DISASM: 100a: {{.*}} callq 3
|
2015-10-16 01:11:03 +08:00
|
|
|
// DISASM: Disassembly of section foo:
|
|
|
|
// DISASM: __start_foo:
|
2015-10-19 23:21:42 +08:00
|
|
|
// DISASM: 100f: 90 nop
|
|
|
|
// DISASM: 1010: 90 nop
|
|
|
|
// DISASM: 1011: 90 nop
|
2015-10-16 01:11:03 +08:00
|
|
|
// DISASM: Disassembly of section bar:
|
|
|
|
// DISASM: __start_bar:
|
2015-10-19 23:21:42 +08:00
|
|
|
// DISASM: 1012: 90 nop
|
|
|
|
// DISASM: 1013: 90 nop
|
|
|
|
// DISASM: 1014: 90 nop
|
|
|
|
|
|
|
|
|
2016-04-14 00:33:02 +08:00
|
|
|
// SYMBOL: Relocations [
|
|
|
|
// SYMBOL-NEXT: Section ({{.*}}) .rela.dyn {
|
2016-08-19 23:36:32 +08:00
|
|
|
// SYMBOL-NEXT: 0x3010 R_X86_64_64 __stop_zed1 0x0
|
|
|
|
// SYMBOL-NEXT: 0x3018 R_X86_64_64 __stop_zed1 0x1
|
|
|
|
// SYMBOL-NEXT: 0x3000 R_X86_64_64 __stop_zed2 0x0
|
|
|
|
// SYMBOL-NEXT: 0x3008 R_X86_64_64 __stop_zed2 0x1
|
2016-04-14 00:33:02 +08:00
|
|
|
// SYMBOL-NEXT: }
|
2015-10-19 23:21:42 +08:00
|
|
|
// SYMBOL-NEXT: ]
|
2015-10-16 01:11:03 +08:00
|
|
|
|
|
|
|
// SYMBOL: Symbol {
|
|
|
|
// SYMBOL: Name: __start_bar
|
2015-10-19 23:21:42 +08:00
|
|
|
// SYMBOL: Value: 0x1012
|
2016-08-19 23:36:32 +08:00
|
|
|
// SYMBOL: STV_HIDDEN
|
2015-10-16 01:11:03 +08:00
|
|
|
// SYMBOL: Section: bar
|
|
|
|
// SYMBOL: }
|
|
|
|
// SYMBOL-NOT: Section: __stop_bar
|
|
|
|
// SYMBOL: Symbol {
|
|
|
|
// SYMBOL: Name: __start_foo
|
2015-10-19 23:21:42 +08:00
|
|
|
// SYMBOL: Value: 0x100F
|
2016-08-19 23:36:32 +08:00
|
|
|
// SYMBOL: STV_HIDDEN
|
2015-10-16 01:11:03 +08:00
|
|
|
// SYMBOL: Section: foo
|
|
|
|
// SYMBOL: }
|
|
|
|
// SYMBOL: Symbol {
|
|
|
|
// SYMBOL: Name: __stop_foo
|
2015-10-19 23:21:42 +08:00
|
|
|
// SYMBOL: Value: 0x1012
|
2016-08-19 23:36:32 +08:00
|
|
|
// STMBOL: STV_HIDDEN
|
2015-10-19 23:21:42 +08:00
|
|
|
// SYMBOL: Section: foo
|
2015-10-16 01:11:03 +08:00
|
|
|
// SYMBOL: }
|
|
|
|
|
2016-08-19 23:36:32 +08:00
|
|
|
// SYMBOL: Symbol {
|
|
|
|
// SYMBOL: Name: __stop_zed1
|
|
|
|
// SYMBOL: Value: 0x3010
|
|
|
|
// STMBOL: Other: 0
|
|
|
|
// SYMBOL: Section: zed1
|
|
|
|
// SYMBOL: }
|
|
|
|
// SYMBOL: Symbol {
|
|
|
|
// SYMBOL: Name: __stop_zed2
|
|
|
|
// SYMBOL: Value: 0x3020
|
|
|
|
// STMBOL: Other: 0
|
|
|
|
// SYMBOL: Section: zed2
|
|
|
|
// SYMBOL: }
|
|
|
|
|
2015-10-19 23:21:42 +08:00
|
|
|
.hidden __start_foo
|
|
|
|
.hidden __stop_foo
|
|
|
|
.hidden __start_bar
|
2015-10-16 01:11:03 +08:00
|
|
|
.global _start
|
|
|
|
.text
|
|
|
|
_start:
|
|
|
|
call __start_foo
|
|
|
|
call __stop_foo
|
|
|
|
call __start_bar
|
|
|
|
|
|
|
|
.section foo,"ax"
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
|
|
|
|
.section bar,"ax"
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
2016-04-14 00:33:02 +08:00
|
|
|
|
2016-05-05 04:25:19 +08:00
|
|
|
.section zed1, "aw"
|
2016-04-14 00:33:02 +08:00
|
|
|
.quad __stop_zed2
|
|
|
|
.quad __stop_zed2 + 1
|
|
|
|
|
2016-05-05 04:25:19 +08:00
|
|
|
.section zed2, "aw"
|
2016-04-14 00:33:02 +08:00
|
|
|
.quad __stop_zed1
|
|
|
|
.quad __stop_zed1 + 1
|