diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-03-30 23:15:07 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-03-30 23:15:07 -0400 |
| commit | 83ff94b1cc761a4f8a222314b26700b13de100a9 (patch) | |
| tree | b0ae675a8fbd2e8dc69895ffb5168cd693e25611 /lib/std/special | |
| parent | f6f03cd90f5c0a8cce7981b16f384b088f41c319 (diff) | |
| download | zig-83ff94b1cc761a4f8a222314b26700b13de100a9.tar.gz zig-83ff94b1cc761a4f8a222314b26700b13de100a9.zip | |
compiler-rt: don't export __clear_cache when no impl available
Diffstat (limited to 'lib/std/special')
| -rw-r--r-- | lib/std/special/compiler_rt.zig | 25 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/clear_cache.zig | 9 |
2 files changed, 24 insertions, 10 deletions
diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index 44db926b5f..6cdc127137 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -10,10 +10,29 @@ comptime { const strong_linkage = if (is_test) builtin.GlobalLinkage.Internal else builtin.GlobalLinkage.Strong; switch (builtin.arch) { - .i386, .x86_64 => @export(@import("compiler_rt/stack_probe.zig").zig_probe_stack, .{ .name = "__zig_probe_stack", .linkage = linkage }), - .aarch64, .aarch64_be, .aarch64_32, .arm, .armeb, .thumb, .thumbeb => { - @export(@import("compiler_rt/clear_cache.zig").clear_cache, .{ .name = "__clear_cache", .linkage = linkage }); + .i386, + .x86_64, + => @export(@import("compiler_rt/stack_probe.zig").zig_probe_stack, .{ + .name = "__zig_probe_stack", + .linkage = linkage, + }), + + .aarch64, + .aarch64_be, + .aarch64_32, + => @export(@import("compiler_rt/clear_cache.zig").clear_cache, .{ + .name = "__clear_cache", + .linkage = linkage, + }), + + .arm, .armeb, .thumb, .thumbeb => switch (builtin.os.tag) { + .linux => @export(@import("compiler_rt/clear_cache.zig").clear_cache, .{ + .name = "__clear_cache", + .linkage = linkage, + }), + else => {}, }, + else => {}, } diff --git a/lib/std/special/compiler_rt/clear_cache.zig b/lib/std/special/compiler_rt/clear_cache.zig index 5d09a7692d..984ef7e7ac 100644 --- a/lib/std/special/compiler_rt/clear_cache.zig +++ b/lib/std/special/compiler_rt/clear_cache.zig @@ -54,15 +54,10 @@ pub fn clear_cache(start: usize, end: usize) callconv(.C) void { // sysarch(ARM_SYNC_ICACHE, &arg); @compileError("TODO: implement for NetBSD/FreeBSD"); } else if (os == .linux) { - const result = std.os.linux.syscall3( - std.os.linux.SYS_cacheflush, - start, - end, - 0, - ); + const result = std.os.linux.syscall3(std.os.linux.SYS_cacheflush, start, end, 0); std.debug.assert(result == 0); } else { - @compileError("compilerrt_abort"); + @compileError("no __clear_cache implementation available for this target"); } } else if (os == .linux and mips) { @compileError("TODO"); |
