Skip to content

Commit 989c501

Browse files
kubkonandrewrk
authored andcommitted
compiler_rt: correctly export allrem and aullrem for i386-windows-msvc
1 parent 8330a95 commit 989c501

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

lib/compiler_rt.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ comptime {
6262
_ = @import("compiler_rt/emutls.zig");
6363
_ = @import("compiler_rt/arm.zig");
6464
_ = @import("compiler_rt/aulldiv.zig");
65+
_ = @import("compiler_rt/aullrem.zig");
6566
_ = @import("compiler_rt/sparc.zig");
6667
_ = @import("compiler_rt/clear_cache.zig");
6768

lib/compiler_rt/aulldiv.zig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ comptime {
1010
// Don't let LLVM apply the stdcall name mangling on those MSVC builtins
1111
@export(_alldiv, .{ .name = "\x01__alldiv", .linkage = linkage });
1212
@export(_aulldiv, .{ .name = "\x01__aulldiv", .linkage = linkage });
13-
@export(_allrem, .{ .name = "\x01__allrem", .linkage = linkage });
14-
@export(_aullrem, .{ .name = "\x01__aullrem", .linkage = linkage });
1513
}
1614
}
1715

lib/compiler_rt/aullrem.zig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1+
const std = @import("std");
12
const builtin = @import("builtin");
3+
const arch = builtin.cpu.arch;
4+
const abi = builtin.abi;
5+
const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Strong;
6+
pub const panic = @import("common.zig").panic;
7+
8+
comptime {
9+
if (arch == .i386 and abi == .msvc) {
10+
// Don't let LLVM apply the stdcall name mangling on those MSVC builtins
11+
@export(_allrem, .{ .name = "\x01__allrem", .linkage = linkage });
12+
@export(_aullrem, .{ .name = "\x01__aullrem", .linkage = linkage });
13+
}
14+
}
215

316
pub fn _allrem(a: i64, b: i64) callconv(.Stdcall) i64 {
417
@setRuntimeSafety(builtin.is_test);

src/compiler_rt.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ const sources = &[_][]const u8{
227227
"compiler_rt/emutls.zig",
228228
"compiler_rt/arm.zig",
229229
"compiler_rt/aulldiv.zig",
230+
"compiler_rt/aullrem.zig",
230231
"compiler_rt/sparc.zig",
231232
"compiler_rt/clear_cache.zig",
232233
};

0 commit comments

Comments
 (0)