1// REQUIRES: x86
2// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3// RUN: ld.lld %t -o %t.so -shared
4// RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=DISASM %s
5// RUN: llvm-readobj --symbols -r %t.so | FileCheck -check-prefix=SYMBOL %s
6
7// DISASM: <_start>:
8// DISASM:    1330:       callq   0x133f <__start_foo>
9// DISASM:    1335:       callq   0x1342 <__start_bar>
10// DISASM:    133a:       callq   0x1342 <__start_bar>
11// DISASM: Disassembly of section foo:
12// DISASM-EMPTY:
13// DISASM: <__start_foo>:
14// DISASM:    133f:       nop
15// DISASM:                nop
16// DISASM:                nop
17// DISASM: Disassembly of section bar:
18// DISASM-EMPTY:
19// DISASM: <__start_bar>:
20// DISASM:    1342:       nop
21// DISASM:                nop
22// DISASM:                nop
23
24// SYMBOL:      Relocations [
25// SYMBOL-NEXT:   Section ({{.*}}) .rela.dyn {
26// SYMBOL-NEXT:     R_X86_64_RELATIVE
27// SYMBOL-NEXT:     R_X86_64_RELATIVE
28// SYMBOL-NEXT:     R_X86_64_RELATIVE
29// SYMBOL-NEXT:     R_X86_64_RELATIVE
30// SYMBOL-NEXT:   }
31// SYMBOL-NEXT: ]
32
33// SYMBOL: Symbol {
34// SYMBOL:   Name: __start_bar
35// SYMBOL:   Value: 0x1342
36// SYMBOL:   STV_HIDDEN
37// SYMBOL:   Section: bar
38// SYMBOL: }
39// SYMBOL-NOT:   Section: __stop_bar
40// SYMBOL: Symbol {
41// SYMBOL:   Name: __start_foo
42// SYMBOL:   Value: 0x133F
43// SYMBOL:   STV_HIDDEN
44// SYMBOL:   Section: foo
45// SYMBOL: }
46// SYMBOL: Symbol {
47// SYMBOL:   Name: __stop_foo
48// SYMBOL:   Value: 0x1342
49// SYMBOL:   STV_HIDDEN
50// SYMBOL:   Section: foo
51// SYMBOL: }
52
53// SYMBOL: Symbol {
54// SYMBOL:   Name: __stop_zed1
55// SYMBOL:   Value: 0x3408
56// SYMBOL:   STV_PROTECTED
57// SYMBOL:   Section: zed1
58// SYMBOL: }
59// SYMBOL: Symbol {
60// SYMBOL:   Name: __stop_zed2
61// SYMBOL:   Value: 0x3418
62// SYMBOL:   STV_PROTECTED
63// SYMBOL:   Section: zed2
64// SYMBOL: }
65
66.hidden __start_foo
67.hidden __stop_foo
68.hidden __start_bar
69.global _start
70.text
71_start:
72	call __start_foo
73	call __stop_foo
74	call __start_bar
75
76.section foo,"ax"
77	nop
78	nop
79	nop
80
81.section bar,"ax"
82	nop
83	nop
84	nop
85
86.section zed1, "aw"
87        .quad __stop_zed2
88        .quad __stop_zed2 + 1
89
90.section zed2, "aw"
91        .quad __stop_zed1
92        .quad __stop_zed1 + 1
93