diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-10-10 21:23:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-10 21:23:28 -0400 |
| commit | 0e0976828afcaaa535857ea7b7d12dfbf7e48de5 (patch) | |
| tree | f7e1438641c3c6803aaca4b6955f6a3875e3d1f3 /lib/std/special | |
| parent | 6082c147533cbefe9f27d8f32b6485c8c43a738f (diff) | |
| parent | 4de3f9d8537fb32017265a2228f9799481db11a0 (diff) | |
| download | zig-0e0976828afcaaa535857ea7b7d12dfbf7e48de5.tar.gz zig-0e0976828afcaaa535857ea7b7d12dfbf7e48de5.zip | |
Merge pull request #3421 from LemonBoy/win32-mingw
Win32 mingw
Diffstat (limited to 'lib/std/special')
| -rw-r--r-- | lib/std/special/compiler_rt.zig | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index 902f2da2ff..0a09f616e9 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -234,24 +234,29 @@ comptime { @export("__aeabi_dcmpun", @import("compiler_rt/comparedf2.zig").__unorddf2, linkage); } if (builtin.os == .windows) { - if (!builtin.link_libc) { + // Default stack-probe functions emitted by LLVM + if (is_mingw) { + @export("_alloca", @import("compiler_rt/stack_probe.zig")._chkstk, strong_linkage); + @export("___chkstk_ms", @import("compiler_rt/stack_probe.zig").___chkstk_ms, strong_linkage); + } else if (!builtin.link_libc) { + // This symbols are otherwise exported by MSVCRT.lib @export("_chkstk", @import("compiler_rt/stack_probe.zig")._chkstk, strong_linkage); @export("__chkstk", @import("compiler_rt/stack_probe.zig").__chkstk, strong_linkage); - @export("___chkstk", @import("compiler_rt/stack_probe.zig").___chkstk, strong_linkage); - @export("__chkstk_ms", @import("compiler_rt/stack_probe.zig").__chkstk_ms, strong_linkage); - @export("___chkstk_ms", @import("compiler_rt/stack_probe.zig").___chkstk_ms, strong_linkage); - } else if (is_mingw) { - @export("___chkstk_ms", @import("compiler_rt/stack_probe.zig").___chkstk_ms, strong_linkage); + } + + if (is_mingw) { @export("__stack_chk_fail", __stack_chk_fail, strong_linkage); @export("__stack_chk_guard", __stack_chk_guard, strong_linkage); } switch (builtin.arch) { .i386 => { - @export("_alldiv", @import("compiler_rt/aulldiv.zig")._alldiv, strong_linkage); - @export("_aulldiv", @import("compiler_rt/aulldiv.zig")._aulldiv, strong_linkage); - @export("_allrem", @import("compiler_rt/aullrem.zig")._allrem, strong_linkage); - @export("_aullrem", @import("compiler_rt/aullrem.zig")._aullrem, strong_linkage); + // Don't let LLVM apply the stdcall name mangling on those MSVC + // builtin functions + @export("\x01__alldiv", @import("compiler_rt/aulldiv.zig")._alldiv, strong_linkage); + @export("\x01__aulldiv", @import("compiler_rt/aulldiv.zig")._aulldiv, strong_linkage); + @export("\x01__allrem", @import("compiler_rt/aullrem.zig")._allrem, strong_linkage); + @export("\x01__aullrem", @import("compiler_rt/aullrem.zig")._aullrem, strong_linkage); @export("__divti3", @import("compiler_rt/divti3.zig").__divti3, linkage); @export("__modti3", @import("compiler_rt/modti3.zig").__modti3, linkage); |
