]> git.saurik.com Git - apple/ld64.git/blob - unit-tests/test-cases/tlv-basic/get.s
ld64-123.2.tar.gz
[apple/ld64.git] / unit-tests / test-cases / tlv-basic / get.s
1
2 # _a is zerofill global TLV
3 .tbss _a$tlv$init,4,2
4
5 # _b is an initialized global TLV
6 .tdata
7 _b$tlv$init:
8 .long 5
9
10 # _c is zerofill non-external TLV
11 .tbss _c$tlv$init,4,2
12
13 # _d is an initialized non-external TLV
14 .tdata
15 _d$tlv$init:
16 .long 5
17
18 #if __x86_64__
19
20 # _a is global TLV
21 .tlv
22 .globl _a
23 _a: .quad __tlv_bootstrap
24 .quad 0
25 .quad _a$tlv$init
26
27 # _b is a global TLV
28 .tlv
29 .globl _b
30 _b: .quad __tlv_bootstrap
31 .quad 0
32 .quad _b$tlv$init
33
34 # _c is a non-external TLV
35 .tlv
36 _c: .quad __tlv_bootstrap
37 .quad 0
38 .quad _c$tlv$init
39
40 # _d is a non-external TLV
41 .tlv
42 _d: .quad __tlv_bootstrap
43 .quad 0
44 .quad _d$tlv$init
45
46
47 .text
48 .globl _get_a
49 _get_a:
50 pushq %rbp
51 movq %rsp, %rbp
52 movq _a@TLVP(%rip), %rdi
53 call *(%rdi)
54 popq %rbp
55 ret
56
57 .globl _get_b
58 _get_b:
59 pushq %rbp
60 movq %rsp, %rbp
61 movq _b@TLVP(%rip), %rdi
62 call *(%rdi)
63 popq %rbp
64 ret
65
66 .globl _get_c
67 _get_c:
68 pushq %rbp
69 movq %rsp, %rbp
70 movq _c@TLVP(%rip), %rdi
71 call *(%rdi)
72 popq %rbp
73 ret
74
75 .globl _get_d
76 _get_d:
77 pushq %rbp
78 movq %rsp, %rbp
79 movq _d@TLVP(%rip), %rdi
80 call *(%rdi)
81 popq %rbp
82 ret
83
84 #endif
85
86 #if __i386__
87
88 # _a is global TLV
89 .tlv
90 .globl _a
91 _a: .long __tlv_bootstrap
92 .long 0
93 .long _a$tlv$init
94
95 # _b is a global TLV
96 .tlv
97 .globl _b
98 _b: .long __tlv_bootstrap
99 .long 0
100 .long _b$tlv$init
101
102 # _c is a non-external TLV
103 .tlv
104 _c: .long __tlv_bootstrap
105 .long 0
106 .long _c$tlv$init
107
108 # _d is a non-external TLV
109 .tlv
110 _d: .long __tlv_bootstrap
111 .long 0
112 .long _d$tlv$init
113
114
115 .text
116 .globl _get_a
117 _get_a:
118 pushl %ebp
119 movl %esp, %ebp
120 subl $8, %esp
121 movl _a@TLVP, %eax
122 call *(%eax)
123 movl %ebp, %esp
124 popl %ebp
125 ret
126
127 .globl _get_b
128 _get_b:
129 pushl %ebp
130 movl %esp, %ebp
131 subl $8, %esp
132 movl _b@TLVP, %eax
133 call *(%eax)
134 movl %ebp, %esp
135 popl %ebp
136 ret
137
138 .globl _get_c
139 _get_c:
140 pushl %ebp
141 movl %esp, %ebp
142 subl $8, %esp
143 movl _c@TLVP, %eax
144 call *(%eax)
145 movl %ebp, %esp
146 popl %ebp
147 ret
148
149 .globl _get_d
150 _get_d:
151 pushl %ebp
152 movl %esp, %ebp
153 subl $8, %esp
154 movl _d@TLVP, %eax
155 call *(%eax)
156 movl %ebp, %esp
157 popl %ebp
158 ret
159
160 #endif
161
162 .subsections_via_symbols