authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-03-30 23:15:07-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-03-30 23:15:07-04:00
log83ff94b1cc761a4f8a222314b26700b13de100a9
treeb0ae675a8fbd2e8dc69895ffb5168cd693e25611
parentf6f03cd90f5c0a8cce7981b16f384b088f41c319
signaturelock-open Commit is signed but in an unrecognized format.

compiler-rt: don't export __clear_cache when no impl available


2 files changed, 24 insertions(+), 10 deletions(-)

lib/std/special/compiler_rt.zig+22-3
......@@ -10,10 +10,29 @@ comptime {
1010 const strong_linkage = if (is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Strong;
1111
1212 switch (builtin.arch) {
13 .i386, .x86_64 => @export(@import("compiler_rt/stack_probe.zig").zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = linkage }),
14 .aarch64, .aarch64_be, .aarch64_32, .arm, .armeb, .thumb, .thumbeb => {
15 @export(@import("compiler_rt/clear_cache.zig").clear_cache, .{ .name = "__clear_cache", .linkage = linkage });
13 .i386,
14 .x86_64,
15 => @export(@import("compiler_rt/stack_probe.zig").zig_probe_stack, .{
16 .name = "__zig_probe_stack",
17 .linkage = linkage,
18 }),
19
20 .aarch64,
21 .aarch64_be,
22 .aarch64_32,
23 => @export(@import("compiler_rt/clear_cache.zig").clear_cache, .{
24 .name = "__clear_cache",
25 .linkage = linkage,
26 }),
27
28 .arm, .armeb, .thumb, .thumbeb => switch (builtin.os.tag) {
29 .linux => @export(@import("compiler_rt/clear_cache.zig").clear_cache, .{
30 .name = "__clear_cache",
31 .linkage = linkage,
32 }),
33 else => {},
1634 },
35
1736 else => {},
1837 }
1938
lib/std/special/compiler_rt/clear_cache.zig+2-7
......@@ -54,15 +54,10 @@ pub fn clear_cache(start: usize, end: usize) callconv(.C) void {
5454 // sysarch(ARM_SYNC_ICACHE, &arg);
5555 @compileError("TODO: implement for NetBSD/FreeBSD");
5656 } else if (os == .linux) {
57 const result = std.os.linux.syscall3(
58 std.os.linux.SYS_cacheflush,
59 start,
60 end,
61 0,
62 );
57 const result = std.os.linux.syscall3(std.os.linux.SYS_cacheflush, start, end, 0);
6358 std.debug.assert(result == 0);
6459 } else {
65 @compileError("compilerrt_abort");
60 @compileError("no __clear_cache implementation available for this target");
6661 }
6762 } else if (os == .linux and mips) {
6863 @compileError("TODO");