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 {...@@ -10,10 +10,29 @@ comptime {
10 const strong_linkage = if (is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Strong;10 const strong_linkage = if (is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Strong;
1111
12 switch (builtin.arch) {12 switch (builtin.arch) {
13 .i386, .x86_64 => @export(@import("compiler_rt/stack_probe.zig").zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = linkage }),13 .i386,
14 .aarch64, .aarch64_be, .aarch64_32, .arm, .armeb, .thumb, .thumbeb => {14 .x86_64,
15 @export(@import("compiler_rt/clear_cache.zig").clear_cache, .{ .name = "__clear_cache", .linkage = linkage });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 => {},
16 },34 },
35
17 else => {},36 else => {},
18 }37 }
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 {...@@ -54,15 +54,10 @@ pub fn clear_cache(start: usize, end: usize) callconv(.C) void {
54 // sysarch(ARM_SYNC_ICACHE, &arg);54 // sysarch(ARM_SYNC_ICACHE, &arg);
55 @compileError("TODO: implement for NetBSD/FreeBSD");55 @compileError("TODO: implement for NetBSD/FreeBSD");
56 } else if (os == .linux) {56 } else if (os == .linux) {
57 const result = std.os.linux.syscall3(57 const result = std.os.linux.syscall3(std.os.linux.SYS_cacheflush, start, end, 0);
58 std.os.linux.SYS_cacheflush,
59 start,
60 end,
61 0,
62 );
63 std.debug.assert(result == 0);58 std.debug.assert(result == 0);
64 } else {59 } else {
65 @compileError("compilerrt_abort");60 @compileError("no __clear_cache implementation available for this target");
66 }61 }
67 } else if (os == .linux and mips) {62 } else if (os == .linux and mips) {
68 @compileError("TODO");63 @compileError("TODO");