diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-01-15 17:49:55 +0100 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2020-01-15 17:50:51 +0100 |
| commit | c5cfc9bf686b5d39d8524c72950eb332814f9707 (patch) | |
| tree | 1b5ebd5b7f160d2c5848c2b2c29e7c96ea5e144e /lib | |
| parent | 5d5345728a0bbcd397a7667148f0c87dd0d7d14d (diff) | |
| download | zig-c5cfc9bf686b5d39d8524c72950eb332814f9707.tar.gz zig-c5cfc9bf686b5d39d8524c72950eb332814f9707.zip | |
Move definition of __aeabi_read_tp
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/os/linux/arm-eabi.zig | 9 | ||||
| -rw-r--r-- | lib/std/special/c.zig | 2 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt.zig | 2 | ||||
| -rw-r--r-- | lib/std/special/compiler_rt/arm.zig | 10 |
4 files changed, 12 insertions, 11 deletions
diff --git a/lib/std/os/linux/arm-eabi.zig b/lib/std/os/linux/arm-eabi.zig index 2e55abd688..0fbbbc4085 100644 --- a/lib/std/os/linux/arm-eabi.zig +++ b/lib/std/os/linux/arm-eabi.zig @@ -88,15 +88,6 @@ pub fn syscall6( /// This matches the libc clone function. pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; -// LLVM calls this when the read-tp-hard feature is set to false. Currently, there is no way to pass -// that to llvm via zig, see https://github.com/ziglang/zig/issues/2883. -// LLVM expects libc to provide this function as __aeabi_read_tp, so it is exported if needed from special/c.zig. -pub fn getThreadPointer() callconv(.C) usize { - return asm volatile ("mrc p15, 0, %[ret], c13, c0, 3" - : [ret] "=r" (-> usize) - ); -} - pub fn restore() callconv(.Naked) void { return asm volatile ("svc #0" : diff --git a/lib/std/special/c.zig b/lib/std/special/c.zig index 9ff794d5b5..0a911ba52b 100644 --- a/lib/std/special/c.zig +++ b/lib/std/special/c.zig @@ -32,8 +32,6 @@ comptime { @export(strlen, .{ .name = "strlen", .linkage = .Strong }); } else if (is_msvc) { @export(_fltused, .{ .name = "_fltused", .linkage = .Strong }); - } else if (builtin.arch == builtin.Arch.arm and builtin.os == .linux) { - @export(std.os.linux.getThreadPointer, .{ .name = "__aeabi_read_tp", .linkage = .Strong }); } } diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index 03e50493c8..2128883545 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -177,6 +177,8 @@ comptime { @export(@import("compiler_rt/arm.zig").__aeabi_memclr, .{ .name = "__aeabi_memclr4", .linkage = linkage }); @export(@import("compiler_rt/arm.zig").__aeabi_memclr, .{ .name = "__aeabi_memclr8", .linkage = linkage }); + @export(@import("compiler_rt/arm.zig").__aeabi_read_tp, .{ .name = "__aeabi_read_tp", .linkage = linkage }); + @export(@import("compiler_rt/extendXfYf2.zig").__aeabi_f2d, .{ .name = "__aeabi_f2d", .linkage = linkage }); @export(@import("compiler_rt/floatsiXf.zig").__aeabi_i2d, .{ .name = "__aeabi_i2d", .linkage = linkage }); @export(@import("compiler_rt/floatdidf.zig").__aeabi_l2d, .{ .name = "__aeabi_l2d", .linkage = linkage }); diff --git a/lib/std/special/compiler_rt/arm.zig b/lib/std/special/compiler_rt/arm.zig index da4b595483..6dab675fc5 100644 --- a/lib/std/special/compiler_rt/arm.zig +++ b/lib/std/special/compiler_rt/arm.zig @@ -32,6 +32,7 @@ pub fn __aeabi_memclr(dest: [*]u8, n: usize) callconv(.AAPCS) void { @setRuntimeSafety(false); _ = memset(dest, 0, n); } + pub fn __aeabi_unwind_cpp_pr0() callconv(.C) void { unreachable; } @@ -42,6 +43,15 @@ pub fn __aeabi_unwind_cpp_pr2() callconv(.C) void { unreachable; } +// This function can only clobber r0 according to the ABI +pub fn __aeabi_read_tp() callconv(.Naked) void { + asm volatile ( + \\ mrc p15, 0, r0, c13, c0, 3 + \\ bx lr + ); + unreachable; +} + // The following functions are wrapped in an asm block to ensure the required // calling convention is always respected |
