aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorJonathan Marler <johnnymarler@gmail.com>2021-09-07 10:44:21 -0600
committerGitHub <noreply@github.com>2021-09-07 19:44:21 +0300
commitfd2c1d860503ec6cd71ab9a692ad2dbf6bd3c269 (patch)
tree3e6b25a478390b5e1797637a019456baf8d7b2d7 /lib/std
parent16c3cd3d19624595f9a840b2147bdf57f4b9e284 (diff)
downloadzig-fd2c1d860503ec6cd71ab9a692ad2dbf6bd3c269.tar.gz
zig-fd2c1d860503ec6cd71ab9a692ad2dbf6bd3c269.zip
Fix building aarch64-windows-gnu by adding missing libc files and compiler_rt functions (#9555)
* fix issue 9519 Added some missing files from mingw * add missing compiler_rt functions * finish PR * add aarch64-windows-gnu to test targets * add more compiler_rt * add log2 * add pow * add modti3
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/special/compiler_rt.zig12
-rw-r--r--lib/std/special/compiler_rt/stack_probe.zig13
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig
index a662f87ea6..ed7f9d0c1c 100644
--- a/lib/std/special/compiler_rt.zig
+++ b/lib/std/special/compiler_rt.zig
@@ -576,6 +576,18 @@ comptime {
},
else => {},
}
+ if (arch.isAARCH64()) {
+ const __chkstk = @import("compiler_rt/stack_probe.zig").__chkstk;
+ @export(__chkstk, .{ .name = "__chkstk", .linkage = strong_linkage });
+ const __divti3_windows = @import("compiler_rt/divti3.zig").__divti3;
+ @export(__divti3_windows, .{ .name = "__divti3", .linkage = linkage });
+ const __modti3 = @import("compiler_rt/modti3.zig").__modti3;
+ @export(__modti3, .{ .name = "__modti3", .linkage = linkage });
+ const __udivti3_windows = @import("compiler_rt/udivti3.zig").__udivti3;
+ @export(__udivti3_windows, .{ .name = "__udivti3", .linkage = linkage });
+ const __umodti3 = @import("compiler_rt/umodti3.zig").__umodti3;
+ @export(__umodti3, .{ .name = "__umodti3", .linkage = linkage });
+ }
} else {
const __divti3 = @import("compiler_rt/divti3.zig").__divti3;
@export(__divti3, .{ .name = "__divti3", .linkage = linkage });
diff --git a/lib/std/special/compiler_rt/stack_probe.zig b/lib/std/special/compiler_rt/stack_probe.zig
index 78f8a2f8bf..db2a86bdfb 100644
--- a/lib/std/special/compiler_rt/stack_probe.zig
+++ b/lib/std/special/compiler_rt/stack_probe.zig
@@ -53,6 +53,19 @@ pub fn zig_probe_stack() callconv(.Naked) void {
},
else => {},
}
+ if (comptime native_arch.isAARCH64()) {
+ asm volatile (
+ \\ lsl x16, x15, #4
+ \\ mov x17, sp
+ \\1:
+ \\ sub x17, x17, #PAGE_SIZE
+ \\ subs x16, x16, #PAGE_SIZE
+ \\ ldr xzr, [x17]
+ \\ b.gt 1b
+ \\
+ \\ ret
+ );
+ }
unreachable;
}