Automatic date update in version.in
[binutils-gdb.git] / ld / testsuite / ld-powerpc / aix-tls-reloc.s
blob062fc9498468bc9a153dcada5297046012991915
1 # An external tdata symbol
2 .globl tdata_ext[TL]
3 .csect tdata_ext[TL]
4 .long 1
6 .csect tdata_int_csect[TL]
7 # A first internal tdata symbol
8 tdata_int1:
9 .long 2
10 # A second internal tdata symbol
11 tdata_int2:
12 .long 3
14 # Two external tbss symbols.
15 # XCOFF doesn't seem to allow internal tbss
16 # (or bss) symbols.
17 .comm tbss_ext[UL],8
19 .toc
20 # TC entries targeting the external tdata symbol
21 # Their value should be "tdata_ext" address,
22 # except TLSM value which must be 0.
23 # Their relocations should target it.
24 .tc tdata_ext_gd[TC],tdata_ext[TL]
25 .tc .tdata_ext_gd[TC],tdata_ext[TL]@m
26 .tc tdata_ext_ld[TC],tdata_ext[TL]@ld
27 .tc tdata_ext_ie[TC],tdata_ext[TL]@ie
28 .tc tdata_ext_le[TC],tdata_ext[TL]@le
30 # TC entries targeting internal tdata symbols.
31 # Their value should be "tdata_int1" or "tdata_int2"
32 # addresses, except TLSM value which must be 0.
33 # Their relocations should target "tdata_int_csect".
34 .tc tdata_int1_gd[TC],tdata_int1
35 .tc .tdata_int1_gd[TC],tdata_int1@m
36 .tc tdata_int1_ld[TC],tdata_int1@ld
37 .tc tdata_int1_ie[TC],tdata_int1@ie
38 .tc tdata_int1_le[TC],tdata_int1@le
39 .tc tdata_int2_gd[TC],tdata_int2
40 .tc .tdata_int2_gd[TC],tdata_int2@m
41 .tc tdata_int2_ld[TC],tdata_int2@ld
42 .tc tdata_int2_ie[TC],tdata_int2@ie
43 .tc tdata_int2_le[TC],tdata_int2@le
45 # TC entries targeting the external tdata symbol
46 # Their value should be "tbss_ext" address,
47 # except TLSM value which must be 0.
48 # Their relocations should target "tbss_ext".
49 .tc tbss_ext_gd[TC],tbss_ext[UL]
50 .tc .tbss_ext_gd[TC],tbss_ext[UL]@m
51 .tc tbss_ext_ld[TC],tbss_ext[UL]@ld
52 .tc tbss_ext_ie[TC],tbss_ext[UL]@ie
53 .tc tbss_ext_le[TC],tbss_ext[UL]@le
55 # Module entry
56 .tc mh[TC],mh[TC]@ml
57 .rename mh[TC], "_$TLSML" # Symbol for the module handle
59 # Macros
60 .macro gd_macro,sym
61 .if size == 32
62 lwz 4, \sym\()[TC](2)
63 lwz 3, .\sym\()[TC](2)
64 .else
65 ld 4, \sym\()[TC](2)
66 ld 3, .\sym\()[TC](2)
67 .endif
68 bla __tls_get_addr
69 .endm
71 .macro ld_macro, sym
72 .if size == 32
73 lwz 4, \sym\()[TC](2)
74 .else
75 ld 4, \sym\()[TC](2)
76 .endif
77 add 5,3,4
78 .endm
80 .macro ie_macro, sym
81 .if size == 32
82 bla __get_tpointer
83 lwz 4, \sym\()[TC](2)
84 add 5,3,4
85 .else
86 ld 4, \sym\()[TC](2)
87 add 5,4,13
88 .endif
89 .endm
91 .macro le_macro, sym
92 .if size == 32
93 bla __get_tpointer
94 lwz 4, \sym\()[TC](2)
95 add 5,3,4
96 .else
97 ld 4, \sym\()[TC](2)
98 add 5,3,13
99 .endif
100 .endm
103 # As TLS relocations are made in for TC symbols,
104 # this function only aims to avoid garbage collection
105 # of these symbols, especially hidden ones.
106 .globl foo
107 .globl .foo
108 .csect foo[DS],3
109 foo:
110 .if size == 32
111 .long .foo, TOC[tc0], 0
112 .else
113 .llong .foo, TOC[tc0], 0
114 .endif
116 .csect foo[PR]
117 .foo:
118 # External syms
120 gd_macro tdata_ext_gd
121 gd_macro tdata_int1_gd
122 gd_macro tdata_int2_gd
123 gd_macro tbss_ext_gd
126 .if size == 32
127 lwz 3, mh[TC](2)
128 .else
129 ld 3, mh[TC](2)
130 .endif
131 bla __tls_get_mod
132 ld_macro tdata_ext_ld
133 ld_macro tdata_int1_ld
134 ld_macro tdata_int2_ld
135 ld_macro tbss_ext_ld
138 ie_macro tdata_ext_ie
139 ie_macro tdata_int1_ie
140 ie_macro tdata_int2_ie
141 ie_macro tbss_ext_ie
144 le_macro tdata_ext_le
145 le_macro tdata_int1_le
146 le_macro tdata_int2_le
147 le_macro tbss_ext_le