| author | |
| committer | |
| log | 5cbae7b6714caf3d12ed585dca25bd7c14fb4a83 |
| tree | 07194432e5c8329c37ee5ff715940cd11376ec1a |
| parent | 8156e4f78f1433a22077571c902b81db44b75d61 |
now the compiler-rt tests are passing on windows. See #30216 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) |
| 52 | 52 | codegen_set_mmacosx_version_min(child_gen, parent_gen->mmacosx_version_min); |
| 53 | 53 | codegen_set_mios_version_min(child_gen, parent_gen->mios_version_min); |
| 54 | 54 | |
| 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 | ||
| 55 | 61 | codegen_build(child_gen); |
| 56 | 62 | const char *o_ext = target_o_file_ext(&child_gen->zig_target); |
| 57 | 63 | 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; |
| 20 | 20 | |
| 21 | 21 | const builtin = @import("builtin"); |
| 22 | 22 | const is_test = builtin.is_test; |
| 23 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 23 | 24 | |
| 24 | 25 | export fn __letf2(a: f128, b: f128) -> c_int { |
| 25 | 26 | @setDebugSafety(this, is_test); |
| 26 | @setGlobalLinkage(__letf2, builtin.GlobalLinkage.LinkOnce); | |
| 27 | @setGlobalLinkage(__letf2, linkage); | |
| 27 | 28 | |
| 28 | 29 | const aInt = @bitCast(rep_t, a); |
| 29 | 30 | const bInt = @bitCast(rep_t, b); |
| ... | ... | @@ -65,7 +66,7 @@ export fn __letf2(a: f128, b: f128) -> c_int { |
| 65 | 66 | // Alias for libgcc compatibility |
| 66 | 67 | // TODO https://github.com/zig-lang/zig/issues/420 |
| 67 | 68 | export fn __cmptf2(a: f128, b: f128) -> c_int { |
| 68 | @setGlobalLinkage(__cmptf2, builtin.GlobalLinkage.LinkOnce); | |
| 69 | @setGlobalLinkage(__cmptf2, linkage); | |
| 69 | 70 | @setDebugSafety(this, is_test); |
| 70 | 71 | return __letf2(a, b); |
| 71 | 72 | } |
| ... | ... | @@ -78,7 +79,7 @@ const GE_GREATER = c_int(1); |
| 78 | 79 | const GE_UNORDERED = c_int(-1); // Note: different from LE_UNORDERED |
| 79 | 80 | |
| 80 | 81 | export fn __getf2(a: f128, b: f128) -> c_int { |
| 81 | @setGlobalLinkage(__getf2, builtin.GlobalLinkage.LinkOnce); | |
| 82 | @setGlobalLinkage(__getf2, linkage); | |
| 82 | 83 | @setDebugSafety(this, is_test); |
| 83 | 84 | |
| 84 | 85 | const aInt = @bitCast(srep_t, a); |
| ... | ... | @@ -108,7 +109,7 @@ export fn __getf2(a: f128, b: f128) -> c_int { |
| 108 | 109 | } |
| 109 | 110 | |
| 110 | 111 | export fn __unordtf2(a: f128, b: f128) -> c_int { |
| 111 | @setGlobalLinkage(__unordtf2, builtin.GlobalLinkage.LinkOnce); | |
| 112 | @setGlobalLinkage(__unordtf2, linkage); | |
| 112 | 113 | @setDebugSafety(this, is_test); |
| 113 | 114 | |
| 114 | 115 | const aAbs = @bitCast(rep_t, a) & absMask; |
| ... | ... | @@ -120,25 +121,25 @@ export fn __unordtf2(a: f128, b: f128) -> c_int { |
| 120 | 121 | // TODO use aliases https://github.com/zig-lang/zig/issues/462 |
| 121 | 122 | |
| 122 | 123 | export fn __eqtf2(a: f128, b: f128) -> c_int { |
| 123 | @setGlobalLinkage(__eqtf2, builtin.GlobalLinkage.LinkOnce); | |
| 124 | @setGlobalLinkage(__eqtf2, linkage); | |
| 124 | 125 | @setDebugSafety(this, is_test); |
| 125 | 126 | return __letf2(a, b); |
| 126 | 127 | } |
| 127 | 128 | |
| 128 | 129 | export fn __lttf2(a: f128, b: f128) -> c_int { |
| 129 | @setGlobalLinkage(__lttf2, builtin.GlobalLinkage.LinkOnce); | |
| 130 | @setGlobalLinkage(__lttf2, linkage); | |
| 130 | 131 | @setDebugSafety(this, is_test); |
| 131 | 132 | return __letf2(a, b); |
| 132 | 133 | } |
| 133 | 134 | |
| 134 | 135 | export fn __netf2(a: f128, b: f128) -> c_int { |
| 135 | @setGlobalLinkage(__netf2, builtin.GlobalLinkage.LinkOnce); | |
| 136 | @setGlobalLinkage(__netf2, linkage); | |
| 136 | 137 | @setDebugSafety(this, is_test); |
| 137 | 138 | return __letf2(a, b); |
| 138 | 139 | } |
| 139 | 140 | |
| 140 | 141 | export fn __gttf2(a: f128, b: f128) -> c_int { |
| 141 | @setGlobalLinkage(__gttf2, builtin.GlobalLinkage.LinkOnce); | |
| 142 | @setGlobalLinkage(__gttf2, linkage); | |
| 142 | 143 | @setDebugSafety(this, is_test); |
| 143 | 144 | return __getf2(a, b); |
| 144 | 145 | } |
std/special/compiler_rt/fixunsdfdi.zig+4-1| ... | ... | @@ -1,7 +1,10 @@ |
| 1 | 1 | const fixuint = @import("fixuint.zig").fixuint; |
| 2 | const builtin = @import("builtin"); | |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 2 | 4 | |
| 3 | 5 | export fn __fixunsdfdi(a: f64) -> u64 { |
| 4 | @setGlobalLinkage(__fixunsdfdi, @import("builtin").GlobalLinkage.LinkOnce); | |
| 6 | @setDebugSafety(this, builtin.is_test); | |
| 7 | @setGlobalLinkage(__fixunsdfdi, linkage); | |
| 5 | 8 | return fixuint(f64, u64, a); |
| 6 | 9 | } |
| 7 | 10 |
std/special/compiler_rt/fixunsdfsi.zig+4-1| ... | ... | @@ -1,7 +1,10 @@ |
| 1 | 1 | const fixuint = @import("fixuint.zig").fixuint; |
| 2 | const builtin = @import("builtin"); | |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 2 | 4 | |
| 3 | 5 | export fn __fixunsdfsi(a: f64) -> u32 { |
| 4 | @setGlobalLinkage(__fixunsdfsi, @import("builtin").GlobalLinkage.LinkOnce); | |
| 6 | @setDebugSafety(this, builtin.is_test); | |
| 7 | @setGlobalLinkage(__fixunsdfsi, linkage); | |
| 5 | 8 | return fixuint(f64, u32, a); |
| 6 | 9 | } |
| 7 | 10 |
std/special/compiler_rt/fixunsdfti.zig+4-1| ... | ... | @@ -1,7 +1,10 @@ |
| 1 | 1 | const fixuint = @import("fixuint.zig").fixuint; |
| 2 | const builtin = @import("builtin"); | |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 2 | 4 | |
| 3 | 5 | export fn __fixunsdfti(a: f64) -> u128 { |
| 4 | @setGlobalLinkage(__fixunsdfti, @import("builtin").GlobalLinkage.LinkOnce); | |
| 6 | @setDebugSafety(this, builtin.is_test); | |
| 7 | @setGlobalLinkage(__fixunsdfti, linkage); | |
| 5 | 8 | return fixuint(f64, u128, a); |
| 6 | 9 | } |
| 7 | 10 |
std/special/compiler_rt/fixunssfdi.zig+4-1| ... | ... | @@ -1,7 +1,10 @@ |
| 1 | 1 | const fixuint = @import("fixuint.zig").fixuint; |
| 2 | const builtin = @import("builtin"); | |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 2 | 4 | |
| 3 | 5 | export fn __fixunssfdi(a: f32) -> u64 { |
| 4 | @setGlobalLinkage(__fixunssfdi, @import("builtin").GlobalLinkage.LinkOnce); | |
| 6 | @setDebugSafety(this, builtin.is_test); | |
| 7 | @setGlobalLinkage(__fixunssfdi, linkage); | |
| 5 | 8 | return fixuint(f32, u64, a); |
| 6 | 9 | } |
| 7 | 10 |
std/special/compiler_rt/fixunssfsi.zig+4-1| ... | ... | @@ -1,7 +1,10 @@ |
| 1 | 1 | const fixuint = @import("fixuint.zig").fixuint; |
| 2 | const builtin = @import("builtin"); | |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 2 | 4 | |
| 3 | 5 | export fn __fixunssfsi(a: f32) -> u32 { |
| 4 | @setGlobalLinkage(__fixunssfsi, @import("builtin").GlobalLinkage.LinkOnce); | |
| 6 | @setDebugSafety(this, builtin.is_test); | |
| 7 | @setGlobalLinkage(__fixunssfsi, linkage); | |
| 5 | 8 | return fixuint(f32, u32, a); |
| 6 | 9 | } |
| 7 | 10 |
std/special/compiler_rt/fixunssfti.zig+4-1| ... | ... | @@ -1,7 +1,10 @@ |
| 1 | 1 | const fixuint = @import("fixuint.zig").fixuint; |
| 2 | const builtin = @import("builtin"); | |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 2 | 4 | |
| 3 | 5 | export fn __fixunssfti(a: f32) -> u128 { |
| 4 | @setGlobalLinkage(__fixunssfti, @import("builtin").GlobalLinkage.LinkOnce); | |
| 6 | @setDebugSafety(this, builtin.is_test); | |
| 7 | @setGlobalLinkage(__fixunssfti, linkage); | |
| 5 | 8 | return fixuint(f32, u128, a); |
| 6 | 9 | } |
| 7 | 10 |
std/special/compiler_rt/fixunstfdi.zig+4-1| ... | ... | @@ -1,7 +1,10 @@ |
| 1 | 1 | const fixuint = @import("fixuint.zig").fixuint; |
| 2 | const builtin = @import("builtin"); | |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 2 | 4 | |
| 3 | 5 | export fn __fixunstfdi(a: f128) -> u64 { |
| 4 | @setGlobalLinkage(__fixunstfdi, @import("builtin").GlobalLinkage.LinkOnce); | |
| 6 | @setDebugSafety(this, builtin.is_test); | |
| 7 | @setGlobalLinkage(__fixunstfdi, linkage); | |
| 5 | 8 | return fixuint(f128, u64, a); |
| 6 | 9 | } |
| 7 | 10 |
std/special/compiler_rt/fixunstfsi.zig+4-1| ... | ... | @@ -1,7 +1,10 @@ |
| 1 | 1 | const fixuint = @import("fixuint.zig").fixuint; |
| 2 | const builtin = @import("builtin"); | |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 2 | 4 | |
| 3 | 5 | export fn __fixunstfsi(a: f128) -> u32 { |
| 4 | @setGlobalLinkage(__fixunstfsi, @import("builtin").GlobalLinkage.LinkOnce); | |
| 6 | @setDebugSafety(this, builtin.is_test); | |
| 7 | @setGlobalLinkage(__fixunstfsi, linkage); | |
| 5 | 8 | return fixuint(f128, u32, a); |
| 6 | 9 | } |
| 7 | 10 |
std/special/compiler_rt/fixunstfti.zig+4-1| ... | ... | @@ -1,7 +1,10 @@ |
| 1 | 1 | const fixuint = @import("fixuint.zig").fixuint; |
| 2 | const builtin = @import("builtin"); | |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 2 | 4 | |
| 3 | 5 | export fn __fixunstfti(a: f128) -> u128 { |
| 4 | @setGlobalLinkage(__fixunstfti, @import("builtin").GlobalLinkage.LinkOnce); | |
| 6 | @setDebugSafety(this, builtin.is_test); | |
| 7 | @setGlobalLinkage(__fixunstfti, linkage); | |
| 5 | 8 | return fixuint(f128, u128, a); |
| 6 | 9 | } |
| 7 | 10 |
std/special/compiler_rt/index.zig+108-105| ... | ... | @@ -21,6 +21,13 @@ const builtin = @import("builtin"); |
| 21 | 21 | const is_test = builtin.is_test; |
| 22 | 22 | const assert = @import("../../debug.zig").assert; |
| 23 | 23 | |
| 24 | ||
| 25 | const win32 = builtin.os == builtin.Os.windows and builtin.arch == builtin.Arch.i386; | |
| 26 | const win64 = builtin.os == builtin.Os.windows and builtin.arch == builtin.Arch.x86_64; | |
| 27 | const win32_nocrt = win32 and !builtin.link_libc; | |
| 28 | const win64_nocrt = win64 and !builtin.link_libc; | |
| 29 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 30 | ||
| 24 | 31 | const __udivmoddi4 = @import("udivmoddi4.zig").__udivmoddi4; |
| 25 | 32 | |
| 26 | 33 | // Avoid dragging in the debug safety mechanisms into this .o file, |
| ... | ... | @@ -35,13 +42,13 @@ pub coldcc fn panic(msg: []const u8) -> noreturn { |
| 35 | 42 | |
| 36 | 43 | export fn __udivdi3(a: u64, b: u64) -> u64 { |
| 37 | 44 | @setDebugSafety(this, is_test); |
| 38 | @setGlobalLinkage(__udivdi3, builtin.GlobalLinkage.LinkOnce); | |
| 45 | @setGlobalLinkage(__udivdi3, linkage); | |
| 39 | 46 | return __udivmoddi4(a, b, null); |
| 40 | 47 | } |
| 41 | 48 | |
| 42 | 49 | export fn __umoddi3(a: u64, b: u64) -> u64 { |
| 43 | 50 | @setDebugSafety(this, is_test); |
| 44 | @setGlobalLinkage(__umoddi3, builtin.GlobalLinkage.LinkOnce); | |
| 51 | @setGlobalLinkage(__umoddi3, linkage); | |
| 45 | 52 | |
| 46 | 53 | var r: u64 = undefined; |
| 47 | 54 | _ = __udivmoddi4(a, b, &r); |
| ... | ... | @@ -55,7 +62,7 @@ const AeabiUlDivModResult = extern struct { |
| 55 | 62 | export fn __aeabi_uldivmod(numerator: u64, denominator: u64) -> AeabiUlDivModResult { |
| 56 | 63 | @setDebugSafety(this, is_test); |
| 57 | 64 | if (comptime isArmArch()) { |
| 58 | @setGlobalLinkage(__aeabi_uldivmod, builtin.GlobalLinkage.LinkOnce); | |
| 65 | @setGlobalLinkage(__aeabi_uldivmod, linkage); | |
| 59 | 66 | var result: AeabiUlDivModResult = undefined; |
| 60 | 67 | result.quot = __udivmoddi4(numerator, denominator, &result.rem); |
| 61 | 68 | return result; |
| ... | ... | @@ -94,7 +101,7 @@ export nakedcc fn __aeabi_uidivmod() { |
| 94 | 101 | @setDebugSafety(this, false); |
| 95 | 102 | |
| 96 | 103 | if (comptime isArmArch()) { |
| 97 | @setGlobalLinkage(__aeabi_uidivmod, builtin.GlobalLinkage.LinkOnce); | |
| 104 | @setGlobalLinkage(__aeabi_uidivmod, linkage); | |
| 98 | 105 | asm volatile ( |
| 99 | 106 | \\ push { lr } |
| 100 | 107 | \\ sub sp, sp, #4 |
| ... | ... | @@ -117,32 +124,31 @@ export nakedcc fn __aeabi_uidivmod() { |
| 117 | 124 | export nakedcc fn _chkstk() align(4) { |
| 118 | 125 | @setDebugSafety(this, false); |
| 119 | 126 | |
| 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; | |
| 146 | 152 | } |
| 147 | 153 | |
| 148 | 154 | @setGlobalLinkage(_chkstk, builtin.GlobalLinkage.Internal); |
| ... | ... | @@ -151,32 +157,31 @@ export nakedcc fn _chkstk() align(4) { |
| 151 | 157 | export nakedcc fn __chkstk() align(4) { |
| 152 | 158 | @setDebugSafety(this, false); |
| 153 | 159 | |
| 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; | |
| 180 | 185 | } |
| 181 | 186 | |
| 182 | 187 | @setGlobalLinkage(__chkstk, builtin.GlobalLinkage.Internal); |
| ... | ... | @@ -188,29 +193,28 @@ export nakedcc fn __chkstk() align(4) { |
| 188 | 193 | export nakedcc fn __chkstk_ms() align(4) { |
| 189 | 194 | @setDebugSafety(this, false); |
| 190 | 195 | |
| 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; | |
| 214 | 218 | } |
| 215 | 219 | |
| 216 | 220 | @setGlobalLinkage(__chkstk_ms, builtin.GlobalLinkage.Internal); |
| ... | ... | @@ -219,29 +223,28 @@ export nakedcc fn __chkstk_ms() align(4) { |
| 219 | 223 | export nakedcc fn ___chkstk_ms() align(4) { |
| 220 | 224 | @setDebugSafety(this, false); |
| 221 | 225 | |
| 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; | |
| 245 | 248 | } |
| 246 | 249 | |
| 247 | 250 | @setGlobalLinkage(___chkstk_ms, builtin.GlobalLinkage.Internal); |
| ... | ... | @@ -249,7 +252,7 @@ export nakedcc fn ___chkstk_ms() align(4) { |
| 249 | 252 | |
| 250 | 253 | export fn __udivmodsi4(a: u32, b: u32, rem: &u32) -> u32 { |
| 251 | 254 | @setDebugSafety(this, is_test); |
| 252 | @setGlobalLinkage(__udivmodsi4, builtin.GlobalLinkage.LinkOnce); | |
| 255 | @setGlobalLinkage(__udivmodsi4, linkage); | |
| 253 | 256 | |
| 254 | 257 | const d = __udivsi3(a, b); |
| 255 | 258 | *rem = u32(i32(a) -% (i32(d) * i32(b))); |
| ... | ... | @@ -262,14 +265,14 @@ export fn __udivmodsi4(a: u32, b: u32, rem: &u32) -> u32 { |
| 262 | 265 | |
| 263 | 266 | export fn __aeabi_uidiv(n: u32, d: u32) -> u32 { |
| 264 | 267 | @setDebugSafety(this, is_test); |
| 265 | @setGlobalLinkage(__aeabi_uidiv, builtin.GlobalLinkage.LinkOnce); | |
| 268 | @setGlobalLinkage(__aeabi_uidiv, linkage); | |
| 266 | 269 | |
| 267 | 270 | return __udivsi3(n, d); |
| 268 | 271 | } |
| 269 | 272 | |
| 270 | 273 | export fn __udivsi3(n: u32, d: u32) -> u32 { |
| 271 | 274 | @setDebugSafety(this, is_test); |
| 272 | @setGlobalLinkage(__udivsi3, builtin.GlobalLinkage.LinkOnce); | |
| 275 | @setGlobalLinkage(__udivsi3, linkage); | |
| 273 | 276 | |
| 274 | 277 | const n_uword_bits: c_uint = u32.bit_count; |
| 275 | 278 | // special cases |
std/special/compiler_rt/udivmoddi4.zig+2-1| ... | ... | @@ -1,9 +1,10 @@ |
| 1 | 1 | const udivmod = @import("udivmod.zig").udivmod; |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 3 | 4 | |
| 4 | 5 | export fn __udivmoddi4(a: u64, b: u64, maybe_rem: ?&u64) -> u64 { |
| 5 | 6 | @setDebugSafety(this, builtin.is_test); |
| 6 | @setGlobalLinkage(__udivmoddi4, builtin.GlobalLinkage.LinkOnce); | |
| 7 | @setGlobalLinkage(__udivmoddi4, linkage); | |
| 7 | 8 | return udivmod(u64, a, b, maybe_rem); |
| 8 | 9 | } |
| 9 | 10 |
std/special/compiler_rt/udivmodti4.zig+2-1| ... | ... | @@ -1,9 +1,10 @@ |
| 1 | 1 | const udivmod = @import("udivmod.zig").udivmod; |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 3 | 4 | |
| 4 | 5 | export fn __udivmodti4(a: u128, b: u128, maybe_rem: ?&u128) -> u128 { |
| 5 | 6 | @setDebugSafety(this, builtin.is_test); |
| 6 | @setGlobalLinkage(__udivmodti4, builtin.GlobalLinkage.LinkOnce); | |
| 7 | @setGlobalLinkage(__udivmodti4, linkage); | |
| 7 | 8 | return udivmod(u128, a, b, maybe_rem); |
| 8 | 9 | } |
| 9 | 10 |
std/special/compiler_rt/udivti3.zig+2-1| ... | ... | @@ -1,8 +1,9 @@ |
| 1 | 1 | const __udivmodti4 = @import("udivmodti4.zig").__udivmodti4; |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 3 | 4 | |
| 4 | 5 | export fn __udivti3(a: u128, b: u128) -> u128 { |
| 5 | 6 | @setDebugSafety(this, builtin.is_test); |
| 6 | @setGlobalLinkage(__udivti3, builtin.GlobalLinkage.LinkOnce); | |
| 7 | @setGlobalLinkage(__udivti3, linkage); | |
| 7 | 8 | return __udivmodti4(a, b, null); |
| 8 | 9 | } |
std/special/compiler_rt/umodti3.zig+2-1| ... | ... | @@ -1,9 +1,10 @@ |
| 1 | 1 | const __udivmodti4 = @import("udivmodti4.zig").__udivmodti4; |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const linkage = if (builtin.is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.LinkOnce; | |
| 3 | 4 | |
| 4 | 5 | export fn __umodti3(a: u128, b: u128) -> u128 { |
| 5 | 6 | @setDebugSafety(this, builtin.is_test); |
| 6 | @setGlobalLinkage(__umodti3, builtin.GlobalLinkage.LinkOnce); | |
| 7 | @setGlobalLinkage(__umodti3, linkage); | |
| 7 | 8 | var r: u128 = undefined; |
| 8 | 9 | _ = __udivmodti4(a, b, &r); |
| 9 | 10 | return r; |