@@ -42,29 +42,21 @@ const R_RELATIVE = switch (builtin.cpu.arch) {
42
42
inline fn getDynamicSymbol () [* ]elf.Dyn {
43
43
return switch (builtin .cpu .arch ) {
44
44
.x86 = > asm volatile (
45
- \\ .weak _DYNAMIC
46
- \\ .hidden _DYNAMIC
47
45
\\ call 1f
48
46
\\ 1: pop %[ret]
49
47
\\ lea _DYNAMIC-1b(%[ret]), %[ret]
50
48
: [ret ] "=r" (- > [* ]elf .Dyn ),
51
49
),
52
50
.x86_64 = > asm volatile (
53
- \\ .weak _DYNAMIC
54
- \\ .hidden _DYNAMIC
55
51
\\ lea _DYNAMIC(%%rip), %[ret]
56
52
: [ret ] "=r" (- > [* ]elf .Dyn ),
57
53
),
58
54
.arc = > asm volatile (
59
- \\ .weak _DYNAMIC
60
- \\ .hidden _DYNAMIC
61
55
\\ add %[ret], pcl, _DYNAMIC@pcl
62
56
: [ret ] "=r" (- > [* ]elf .Dyn ),
63
57
),
64
58
// Work around the limited offset range of `ldr`
65
59
.arm , .armeb , .thumb , .thumbeb = > asm volatile (
66
- \\ .weak _DYNAMIC
67
- \\ .hidden _DYNAMIC
68
60
\\ ldr %[ret], 1f
69
61
\\ add %[ret], pc
70
62
\\ b 2f
@@ -74,8 +66,6 @@ inline fn getDynamicSymbol() [*]elf.Dyn {
74
66
),
75
67
// A simple `adr` is not enough as it has a limited offset range
76
68
.aarch64 , .aarch64_be = > asm volatile (
77
- \\ .weak _DYNAMIC
78
- \\ .hidden _DYNAMIC
79
69
\\ adrp %[ret], _DYNAMIC
80
70
\\ add %[ret], %[ret], #:lo12:_DYNAMIC
81
71
: [ret ] "=r" (- > [* ]elf .Dyn ),
@@ -88,8 +78,6 @@ inline fn getDynamicSymbol() [*]elf.Dyn {
88
78
: [ret ] "=r" (- > [* ]elf .Dyn ),
89
79
),
90
80
.hexagon = > asm volatile (
91
- \\ .weak _DYNAMIC
92
- \\ .hidden _DYNAMIC
93
81
\\ jump 1f
94
82
\\ .word _DYNAMIC - .
95
83
\\ 1:
@@ -102,23 +90,17 @@ inline fn getDynamicSymbol() [*]elf.Dyn {
102
90
: "r1"
103
91
),
104
92
.loongarch32 , .loongarch64 = > asm volatile (
105
- \\ .weak _DYNAMIC
106
- \\ .hidden _DYNAMIC
107
93
\\ la.local %[ret], _DYNAMIC
108
94
: [ret ] "=r" (- > [* ]elf .Dyn ),
109
95
),
110
96
// Note that the - 8 is needed because pc in the second lea instruction points into the
111
97
// middle of that instruction. (The first lea is 6 bytes, the second is 4 bytes.)
112
98
.m68k = > asm volatile (
113
- \\ .weak _DYNAMIC
114
- \\ .hidden _DYNAMIC
115
99
\\ lea _DYNAMIC - . - 8, %[ret]
116
100
\\ lea (%[ret], %%pc), %[ret]
117
101
: [ret ] "=r" (- > [* ]elf .Dyn ),
118
102
),
119
103
.mips , .mipsel = > asm volatile (
120
- \\ .weak _DYNAMIC
121
- \\ .hidden _DYNAMIC
122
104
\\ bal 1f
123
105
\\ .gpword _DYNAMIC
124
106
\\ 1:
@@ -129,8 +111,6 @@ inline fn getDynamicSymbol() [*]elf.Dyn {
129
111
: "lr"
130
112
),
131
113
.mips64 , .mips64el = > asm volatile (
132
- \\ .weak _DYNAMIC
133
- \\ .hidden _DYNAMIC
134
114
\\ .balign 8
135
115
\\ bal 1f
136
116
\\ .gpdword _DYNAMIC
@@ -142,8 +122,6 @@ inline fn getDynamicSymbol() [*]elf.Dyn {
142
122
: "lr"
143
123
),
144
124
.powerpc , .powerpcle = > asm volatile (
145
- \\ .weak _DYNAMIC
146
- \\ .hidden _DYNAMIC
147
125
\\ bl 1f
148
126
\\ .long _DYNAMIC - .
149
127
\\ 1:
@@ -155,8 +133,6 @@ inline fn getDynamicSymbol() [*]elf.Dyn {
155
133
: "lr" , "r4"
156
134
),
157
135
.powerpc64 , .powerpc64le = > asm volatile (
158
- \\ .weak _DYNAMIC
159
- \\ .hidden _DYNAMIC
160
136
\\ bl 1f
161
137
\\ .quad _DYNAMIC - .
162
138
\\ 1:
@@ -168,14 +144,10 @@ inline fn getDynamicSymbol() [*]elf.Dyn {
168
144
: "lr" , "r4"
169
145
),
170
146
.riscv32 , .riscv64 = > asm volatile (
171
- \\ .weak _DYNAMIC
172
- \\ .hidden _DYNAMIC
173
147
\\ lla %[ret], _DYNAMIC
174
148
: [ret ] "=r" (- > [* ]elf .Dyn ),
175
149
),
176
150
.s390x = > asm volatile (
177
- \\ .weak _DYNAMIC
178
- \\ .hidden _DYNAMIC
179
151
\\ larl %[ret], 1f
180
152
\\ ag %[ret], 0(%[ret])
181
153
\\ b 2f
0 commit comments