authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-10-02 00:10:42-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-10-02 00:11:45-04:00
log5cbae7b6714caf3d12ed585dca25bd7c14fb4a83
tree07194432e5c8329c37ee5ff715940cd11376ec1a
parent8156e4f78f1433a22077571c902b81db44b75d61

better compiler-rt linkage logic

now the compiler-rt tests are passing on windows. See #302

16 files changed, 167 insertions(+), 126 deletions(-)

src/link.cpp+6
......@@ -52,6 +52,12 @@ static Buf *build_o_raw(CodeGen *parent_gen, const char *oname, Buf *full_path)
5252 codegen_set_mmacosx_version_min(child_gen, parent_gen->mmacosx_version_min);
5353 codegen_set_mios_version_min(child_gen, parent_gen->mios_version_min);
5454
55 for (size_t i = 0; i < parent_gen->link_libs_list.length; i += 1) {
56 LinkLib *link_lib = parent_gen->link_libs_list.at(i);
57 LinkLib *new_link_lib = codegen_add_link_lib(child_gen, link_lib->name);
58 new_link_lib->provided_explicitly = link_lib->provided_explicitly;
59 }
60
5561 codegen_build(child_gen);
5662 const char *o_ext = target_o_file_ext(&child_gen->zig_target);
5763 Buf *o_out_name = buf_sprintf("%s%s", oname, o_ext);
std/special/compiler_rt/comparetf2.zig+9-8
......@@ -20,10 +20,11 @@ const infRep = exponentMask;
2020
2121const builtin = @import("builtin");
2222const is_test = builtin.is_test;
23const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
2324
2425export fn __letf2(a: f128, b: f128) -> c_int {
2526 @setDebugSafety(this, is_test);
26 @setGlobalLinkage(__letf2, builtin.GlobalLinkage.LinkOnce);
27 @setGlobalLinkage(__letf2, linkage);
2728
2829 const aInt = @bitCast(rep_t, a);
2930 const bInt = @bitCast(rep_t, b);
......@@ -65,7 +66,7 @@ export fn __letf2(a: f128, b: f128) -> c_int {
6566// Alias for libgcc compatibility
6667// TODO https://github.com/zig-lang/zig/issues/420
6768export fn __cmptf2(a: f128, b: f128) -> c_int {
68 @setGlobalLinkage(__cmptf2, builtin.GlobalLinkage.LinkOnce);
69 @setGlobalLinkage(__cmptf2, linkage);
6970 @setDebugSafety(this, is_test);
7071 return __letf2(a, b);
7172}
......@@ -78,7 +79,7 @@ const GE_GREATER = c_int(1);
7879const GE_UNORDERED = c_int(-1); // Note: different from LE_UNORDERED
7980
8081export fn __getf2(a: f128, b: f128) -> c_int {
81 @setGlobalLinkage(__getf2, builtin.GlobalLinkage.LinkOnce);
82 @setGlobalLinkage(__getf2, linkage);
8283 @setDebugSafety(this, is_test);
8384
8485 const aInt = @bitCast(srep_t, a);
......@@ -108,7 +109,7 @@ export fn __getf2(a: f128, b: f128) -> c_int {
108109}
109110
110111export fn __unordtf2(a: f128, b: f128) -> c_int {
111 @setGlobalLinkage(__unordtf2, builtin.GlobalLinkage.LinkOnce);
112 @setGlobalLinkage(__unordtf2, linkage);
112113 @setDebugSafety(this, is_test);
113114
114115 const aAbs = @bitCast(rep_t, a) & absMask;
......@@ -120,25 +121,25 @@ export fn __unordtf2(a: f128, b: f128) -> c_int {
120121// TODO use aliases https://github.com/zig-lang/zig/issues/462
121122
122123export fn __eqtf2(a: f128, b: f128) -> c_int {
123 @setGlobalLinkage(__eqtf2, builtin.GlobalLinkage.LinkOnce);
124 @setGlobalLinkage(__eqtf2, linkage);
124125 @setDebugSafety(this, is_test);
125126 return __letf2(a, b);
126127}
127128
128129export fn __lttf2(a: f128, b: f128) -> c_int {
129 @setGlobalLinkage(__lttf2, builtin.GlobalLinkage.LinkOnce);
130 @setGlobalLinkage(__lttf2, linkage);
130131 @setDebugSafety(this, is_test);
131132 return __letf2(a, b);
132133}
133134
134135export fn __netf2(a: f128, b: f128) -> c_int {
135 @setGlobalLinkage(__netf2, builtin.GlobalLinkage.LinkOnce);
136 @setGlobalLinkage(__netf2, linkage);
136137 @setDebugSafety(this, is_test);
137138 return __letf2(a, b);
138139}
139140
140141export fn __gttf2(a: f128, b: f128) -> c_int {
141 @setGlobalLinkage(__gttf2, builtin.GlobalLinkage.LinkOnce);
142 @setGlobalLinkage(__gttf2, linkage);
142143 @setDebugSafety(this, is_test);
143144 return __getf2(a, b);
144145}
std/special/compiler_rt/fixunsdfdi.zig+4-1
......@@ -1,7 +1,10 @@
11const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
24
35export fn __fixunsdfdi(a: f64) -> u64 {
4 @setGlobalLinkage(__fixunsdfdi, @import("builtin").GlobalLinkage.LinkOnce);
6 @setDebugSafety(this, builtin.is_test);
7 @setGlobalLinkage(__fixunsdfdi, linkage);
58 return fixuint(f64, u64, a);
69}
710
std/special/compiler_rt/fixunsdfsi.zig+4-1
......@@ -1,7 +1,10 @@
11const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
24
35export fn __fixunsdfsi(a: f64) -> u32 {
4 @setGlobalLinkage(__fixunsdfsi, @import("builtin").GlobalLinkage.LinkOnce);
6 @setDebugSafety(this, builtin.is_test);
7 @setGlobalLinkage(__fixunsdfsi, linkage);
58 return fixuint(f64, u32, a);
69}
710
std/special/compiler_rt/fixunsdfti.zig+4-1
......@@ -1,7 +1,10 @@
11const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
24
35export fn __fixunsdfti(a: f64) -> u128 {
4 @setGlobalLinkage(__fixunsdfti, @import("builtin").GlobalLinkage.LinkOnce);
6 @setDebugSafety(this, builtin.is_test);
7 @setGlobalLinkage(__fixunsdfti, linkage);
58 return fixuint(f64, u128, a);
69}
710
std/special/compiler_rt/fixunssfdi.zig+4-1
......@@ -1,7 +1,10 @@
11const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
24
35export fn __fixunssfdi(a: f32) -> u64 {
4 @setGlobalLinkage(__fixunssfdi, @import("builtin").GlobalLinkage.LinkOnce);
6 @setDebugSafety(this, builtin.is_test);
7 @setGlobalLinkage(__fixunssfdi, linkage);
58 return fixuint(f32, u64, a);
69}
710
std/special/compiler_rt/fixunssfsi.zig+4-1
......@@ -1,7 +1,10 @@
11const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
24
35export fn __fixunssfsi(a: f32) -> u32 {
4 @setGlobalLinkage(__fixunssfsi, @import("builtin").GlobalLinkage.LinkOnce);
6 @setDebugSafety(this, builtin.is_test);
7 @setGlobalLinkage(__fixunssfsi, linkage);
58 return fixuint(f32, u32, a);
69}
710
std/special/compiler_rt/fixunssfti.zig+4-1
......@@ -1,7 +1,10 @@
11const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
24
35export fn __fixunssfti(a: f32) -> u128 {
4 @setGlobalLinkage(__fixunssfti, @import("builtin").GlobalLinkage.LinkOnce);
6 @setDebugSafety(this, builtin.is_test);
7 @setGlobalLinkage(__fixunssfti, linkage);
58 return fixuint(f32, u128, a);
69}
710
std/special/compiler_rt/fixunstfdi.zig+4-1
......@@ -1,7 +1,10 @@
11const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
24
35export fn __fixunstfdi(a: f128) -> u64 {
4 @setGlobalLinkage(__fixunstfdi, @import("builtin").GlobalLinkage.LinkOnce);
6 @setDebugSafety(this, builtin.is_test);
7 @setGlobalLinkage(__fixunstfdi, linkage);
58 return fixuint(f128, u64, a);
69}
710
std/special/compiler_rt/fixunstfsi.zig+4-1
......@@ -1,7 +1,10 @@
11const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
24
35export fn __fixunstfsi(a: f128) -> u32 {
4 @setGlobalLinkage(__fixunstfsi, @import("builtin").GlobalLinkage.LinkOnce);
6 @setDebugSafety(this, builtin.is_test);
7 @setGlobalLinkage(__fixunstfsi, linkage);
58 return fixuint(f128, u32, a);
69}
710
std/special/compiler_rt/fixunstfti.zig+4-1
......@@ -1,7 +1,10 @@
11const fixuint = @import("fixuint.zig").fixuint;
2const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
24
35export fn __fixunstfti(a: f128) -> u128 {
4 @setGlobalLinkage(__fixunstfti, @import("builtin").GlobalLinkage.LinkOnce);
6 @setDebugSafety(this, builtin.is_test);
7 @setGlobalLinkage(__fixunstfti, linkage);
58 return fixuint(f128, u128, a);
69}
710
std/special/compiler_rt/index.zig+108-105
......@@ -21,6 +21,13 @@ const builtin = @import("builtin");
2121const is_test = builtin.is_test;
2222const assert = @import("../../debug.zig").assert;
2323
24
25const win32 = builtin.os == builtin.Os.windows and builtin.arch == builtin.Arch.i386;
26const win64 = builtin.os == builtin.Os.windows and builtin.arch == builtin.Arch.x86_64;
27const win32_nocrt = win32 and !builtin.link_libc;
28const win64_nocrt = win64 and !builtin.link_libc;
29const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
30
2431const __udivmoddi4 = @import("udivmoddi4.zig").__udivmoddi4;
2532
2633// Avoid dragging in the debug safety mechanisms into this .o file,
......@@ -35,13 +42,13 @@ pub coldcc fn panic(msg: []const u8) -> noreturn {
3542
3643export fn __udivdi3(a: u64, b: u64) -> u64 {
3744 @setDebugSafety(this, is_test);
38 @setGlobalLinkage(__udivdi3, builtin.GlobalLinkage.LinkOnce);
45 @setGlobalLinkage(__udivdi3, linkage);
3946 return __udivmoddi4(a, b, null);
4047}
4148
4249export fn __umoddi3(a: u64, b: u64) -> u64 {
4350 @setDebugSafety(this, is_test);
44 @setGlobalLinkage(__umoddi3, builtin.GlobalLinkage.LinkOnce);
51 @setGlobalLinkage(__umoddi3, linkage);
4552
4653 var r: u64 = undefined;
4754 _ = __udivmoddi4(a, b, &r);
......@@ -55,7 +62,7 @@ const AeabiUlDivModResult = extern struct {
5562export fn __aeabi_uldivmod(numerator: u64, denominator: u64) -> AeabiUlDivModResult {
5663 @setDebugSafety(this, is_test);
5764 if (comptime isArmArch()) {
58 @setGlobalLinkage(__aeabi_uldivmod, builtin.GlobalLinkage.LinkOnce);
65 @setGlobalLinkage(__aeabi_uldivmod, linkage);
5966 var result: AeabiUlDivModResult = undefined;
6067 result.quot = __udivmoddi4(numerator, denominator, &result.rem);
6168 return result;
......@@ -94,7 +101,7 @@ export nakedcc fn __aeabi_uidivmod() {
94101 @setDebugSafety(this, false);
95102
96103 if (comptime isArmArch()) {
97 @setGlobalLinkage(__aeabi_uidivmod, builtin.GlobalLinkage.LinkOnce);
104 @setGlobalLinkage(__aeabi_uidivmod, linkage);
98105 asm volatile (
99106 \\ push { lr }
100107 \\ sub sp, sp, #4
......@@ -117,32 +124,31 @@ export nakedcc fn __aeabi_uidivmod() {
117124export nakedcc fn _chkstk() align(4) {
118125 @setDebugSafety(this, false);
119126
120 if (comptime builtin.os == builtin.Os.windows) {
121 if (comptime builtin.arch == builtin.Arch.i386) {
122 asm volatile (
123 \\ push %%ecx
124 \\ cmp $0x1000,%%eax
125 \\ lea 8(%%esp),%%ecx // esp before calling this routine -> ecx
126 \\ jb 1f
127 \\ 2:
128 \\ sub $0x1000,%%ecx
129 \\ test %%ecx,(%%ecx)
130 \\ sub $0x1000,%%eax
131 \\ cmp $0x1000,%%eax
132 \\ ja 2b
133 \\ 1:
134 \\ sub %%eax,%%ecx
135 \\ test %%ecx,(%%ecx)
136 \\
137 \\ lea 4(%%esp),%%eax // load pointer to the return address into eax
138 \\ mov %%ecx,%%esp // install the new top of stack pointer into esp
139 \\ mov -4(%%eax),%%ecx // restore ecx
140 \\ push (%%eax) // push return address onto the stack
141 \\ sub %%esp,%%eax // restore the original value in eax
142 \\ ret
143 );
144 unreachable;
145 }
127 if (win32_nocrt) {
128 @setGlobalLinkage(_chkstk, linkage);
129 asm volatile (
130 \\ push %%ecx
131 \\ cmp $0x1000,%%eax
132 \\ lea 8(%%esp),%%ecx // esp before calling this routine -> ecx
133 \\ jb 1f
134 \\ 2:
135 \\ sub $0x1000,%%ecx
136 \\ test %%ecx,(%%ecx)
137 \\ sub $0x1000,%%eax
138 \\ cmp $0x1000,%%eax
139 \\ ja 2b
140 \\ 1:
141 \\ sub %%eax,%%ecx
142 \\ test %%ecx,(%%ecx)
143 \\
144 \\ lea 4(%%esp),%%eax // load pointer to the return address into eax
145 \\ mov %%ecx,%%esp // install the new top of stack pointer into esp
146 \\ mov -4(%%eax),%%ecx // restore ecx
147 \\ push (%%eax) // push return address onto the stack
148 \\ sub %%esp,%%eax // restore the original value in eax
149 \\ ret
150 );
151 unreachable;
146152 }
147153
148154 @setGlobalLinkage(_chkstk, builtin.GlobalLinkage.Internal);
......@@ -151,32 +157,31 @@ export nakedcc fn _chkstk() align(4) {
151157export nakedcc fn __chkstk() align(4) {
152158 @setDebugSafety(this, false);
153159
154 if (comptime builtin.os == builtin.Os.windows) {
155 if (comptime builtin.arch == builtin.Arch.x86_64) {
156 asm volatile (
157 \\ push %%rcx
158 \\ cmp $0x1000,%%rax
159 \\ lea 16(%%rsp),%%rcx // rsp before calling this routine -> rcx
160 \\ jb 1f
161 \\ 2:
162 \\ sub $0x1000,%%rcx
163 \\ test %%rcx,(%%rcx)
164 \\ sub $0x1000,%%rax
165 \\ cmp $0x1000,%%rax
166 \\ ja 2b
167 \\ 1:
168 \\ sub %%rax,%%rcx
169 \\ test %%rcx,(%%rcx)
170 \\
171 \\ lea 8(%%rsp),%%rax // load pointer to the return address into rax
172 \\ mov %%rcx,%%rsp // install the new top of stack pointer into rsp
173 \\ mov -8(%%rax),%%rcx // restore rcx
174 \\ push (%%rax) // push return address onto the stack
175 \\ sub %%rsp,%%rax // restore the original value in rax
176 \\ ret
177 );
178 unreachable;
179 }
160 if (win64_nocrt) {
161 @setGlobalLinkage(__chkstk, linkage);
162 asm volatile (
163 \\ push %%rcx
164 \\ cmp $0x1000,%%rax
165 \\ lea 16(%%rsp),%%rcx // rsp before calling this routine -> rcx
166 \\ jb 1f
167 \\ 2:
168 \\ sub $0x1000,%%rcx
169 \\ test %%rcx,(%%rcx)
170 \\ sub $0x1000,%%rax
171 \\ cmp $0x1000,%%rax
172 \\ ja 2b
173 \\ 1:
174 \\ sub %%rax,%%rcx
175 \\ test %%rcx,(%%rcx)
176 \\
177 \\ lea 8(%%rsp),%%rax // load pointer to the return address into rax
178 \\ mov %%rcx,%%rsp // install the new top of stack pointer into rsp
179 \\ mov -8(%%rax),%%rcx // restore rcx
180 \\ push (%%rax) // push return address onto the stack
181 \\ sub %%rsp,%%rax // restore the original value in rax
182 \\ ret
183 );
184 unreachable;
180185 }
181186
182187 @setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal);
......@@ -188,29 +193,28 @@ export nakedcc fn __chkstk() align(4) {
188193export nakedcc fn __chkstk_ms() align(4) {
189194 @setDebugSafety(this, false);
190195
191 if (comptime builtin.os == builtin.Os.windows) {
192 if (comptime builtin.arch == builtin.Arch.i386) {
193 asm volatile (
194 \\ push %%ecx
195 \\ push %%eax
196 \\ cmp $0x1000,%%eax
197 \\ lea 12(%%esp),%%ecx
198 \\ jb 1f
199 \\ 2:
200 \\ sub $0x1000,%%ecx
201 \\ test %%ecx,(%%ecx)
202 \\ sub $0x1000,%%eax
203 \\ cmp $0x1000,%%eax
204 \\ ja 2b
205 \\ 1:
206 \\ sub %%eax,%%ecx
207 \\ test %%ecx,(%%ecx)
208 \\ pop %%eax
209 \\ pop %%ecx
210 \\ ret
211 );
212 unreachable;
213 }
196 if (win32_nocrt) {
197 @setGlobalLinkage(__chkstk, linkage);
198 asm volatile (
199 \\ push %%ecx
200 \\ push %%eax
201 \\ cmp $0x1000,%%eax
202 \\ lea 12(%%esp),%%ecx
203 \\ jb 1f
204 \\ 2:
205 \\ sub $0x1000,%%ecx
206 \\ test %%ecx,(%%ecx)
207 \\ sub $0x1000,%%eax
208 \\ cmp $0x1000,%%eax
209 \\ ja 2b
210 \\ 1:
211 \\ sub %%eax,%%ecx
212 \\ test %%ecx,(%%ecx)
213 \\ pop %%eax
214 \\ pop %%ecx
215 \\ ret
216 );
217 unreachable;
214218 }
215219
216220 @setGlobalLinkage(__chkstk_ms, builtin.GlobalLinkage.Internal);
......@@ -219,29 +223,28 @@ export nakedcc fn __chkstk_ms() align(4) {
219223export nakedcc fn ___chkstk_ms() align(4) {
220224 @setDebugSafety(this, false);
221225
222 if (comptime builtin.os == builtin.Os.windows) {
223 if (comptime builtin.arch == builtin.Arch.x86_64) {
224 asm volatile (
225 \\ push %%rcx
226 \\ push %%rax
227 \\ cmp $0x1000,%%rax
228 \\ lea 24(%%rsp),%%rcx
229 \\ jb 1f
230 \\2:
231 \\ sub $0x1000,%%rcx
232 \\ test %%rcx,(%%rcx)
233 \\ sub $0x1000,%%rax
234 \\ cmp $0x1000,%%rax
235 \\ ja 2b
236 \\1:
237 \\ sub %%rax,%%rcx
238 \\ test %%rcx,(%%rcx)
239 \\ pop %%rax
240 \\ pop %%rcx
241 \\ ret
242 );
243 unreachable;
244 }
226 if (win64_nocrt) {
227 @setGlobalLinkage(___chkstk_ms, linkage);
228 asm volatile (
229 \\ push %%rcx
230 \\ push %%rax
231 \\ cmp $0x1000,%%rax
232 \\ lea 24(%%rsp),%%rcx
233 \\ jb 1f
234 \\2:
235 \\ sub $0x1000,%%rcx
236 \\ test %%rcx,(%%rcx)
237 \\ sub $0x1000,%%rax
238 \\ cmp $0x1000,%%rax
239 \\ ja 2b
240 \\1:
241 \\ sub %%rax,%%rcx
242 \\ test %%rcx,(%%rcx)
243 \\ pop %%rax
244 \\ pop %%rcx
245 \\ ret
246 );
247 unreachable;
245248 }
246249
247250 @setGlobalLinkage(___chkstk_ms, builtin.GlobalLinkage.Internal);
......@@ -249,7 +252,7 @@ export nakedcc fn ___chkstk_ms() align(4) {
249252
250253export fn __udivmodsi4(a: u32, b: u32, rem: &u32) -> u32 {
251254 @setDebugSafety(this, is_test);
252 @setGlobalLinkage(__udivmodsi4, builtin.GlobalLinkage.LinkOnce);
255 @setGlobalLinkage(__udivmodsi4, linkage);
253256
254257 const d = __udivsi3(a, b);
255258 *rem = u32(i32(a) -% (i32(d) * i32(b)));
......@@ -262,14 +265,14 @@ export fn __udivmodsi4(a: u32, b: u32, rem: &u32) -> u32 {
262265
263266export fn __aeabi_uidiv(n: u32, d: u32) -> u32 {
264267 @setDebugSafety(this, is_test);
265 @setGlobalLinkage(__aeabi_uidiv, builtin.GlobalLinkage.LinkOnce);
268 @setGlobalLinkage(__aeabi_uidiv, linkage);
266269
267270 return __udivsi3(n, d);
268271}
269272
270273export fn __udivsi3(n: u32, d: u32) -> u32 {
271274 @setDebugSafety(this, is_test);
272 @setGlobalLinkage(__udivsi3, builtin.GlobalLinkage.LinkOnce);
275 @setGlobalLinkage(__udivsi3, linkage);
273276
274277 const n_uword_bits: c_uint = u32.bit_count;
275278 // special cases
std/special/compiler_rt/udivmoddi4.zig+2-1
......@@ -1,9 +1,10 @@
11const udivmod = @import("udivmod.zig").udivmod;
22const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
34
45export fn __udivmoddi4(a: u64, b: u64, maybe_rem: ?&u64) -> u64 {
56 @setDebugSafety(this, builtin.is_test);
6 @setGlobalLinkage(__udivmoddi4, builtin.GlobalLinkage.LinkOnce);
7 @setGlobalLinkage(__udivmoddi4, linkage);
78 return udivmod(u64, a, b, maybe_rem);
89}
910
std/special/compiler_rt/udivmodti4.zig+2-1
......@@ -1,9 +1,10 @@
11const udivmod = @import("udivmod.zig").udivmod;
22const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
34
45export fn __udivmodti4(a: u128, b: u128, maybe_rem: ?&u128) -> u128 {
56 @setDebugSafety(this, builtin.is_test);
6 @setGlobalLinkage(__udivmodti4, builtin.GlobalLinkage.LinkOnce);
7 @setGlobalLinkage(__udivmodti4, linkage);
78 return udivmod(u128, a, b, maybe_rem);
89}
910
std/special/compiler_rt/udivti3.zig+2-1
......@@ -1,8 +1,9 @@
11const __udivmodti4 = @import("udivmodti4.zig").__udivmodti4;
22const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
34
45export fn __udivti3(a: u128, b: u128) -> u128 {
56 @setDebugSafety(this, builtin.is_test);
6 @setGlobalLinkage(__udivti3, builtin.GlobalLinkage.LinkOnce);
7 @setGlobalLinkage(__udivti3, linkage);
78 return __udivmodti4(a, b, null);
89}
std/special/compiler_rt/umodti3.zig+2-1
......@@ -1,9 +1,10 @@
11const __udivmodti4 = @import("udivmodti4.zig").__udivmodti4;
22const builtin = @import("builtin");
3const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce;
34
45export fn __umodti3(a: u128, b: u128) -> u128 {
56 @setDebugSafety(this, builtin.is_test);
6 @setGlobalLinkage(__umodti3, builtin.GlobalLinkage.LinkOnce);
7 @setGlobalLinkage(__umodti3, linkage);
78 var r: u128 = undefined;
89 _ = __udivmodti4(a, b, &r);
910 return r;