diff --git a/lib/libc/glibc/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h b/lib/libc/glibc/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h deleted file mode 100644 index d632a0c5c7..0000000000 --- a/lib/libc/glibc/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Machine-specific pthread type layouts. SPARC version. - Copyright (C) 2003-2019 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#ifndef _BITS_PTHREADTYPES_ARCH_H -#define _BITS_PTHREADTYPES_ARCH_H 1 - -#include - -#if __WORDSIZE == 64 -# define __SIZEOF_PTHREAD_ATTR_T 56 -# define __SIZEOF_PTHREAD_MUTEX_T 40 -# define __SIZEOF_PTHREAD_CONDATTR_T 4 -# define __SIZEOF_PTHREAD_RWLOCK_T 56 -# define __SIZEOF_PTHREAD_BARRIER_T 32 -#else -# define __SIZEOF_PTHREAD_ATTR_T 36 -# define __SIZEOF_PTHREAD_MUTEX_T 24 -# define __SIZEOF_PTHREAD_CONDATTR_T 4 -# define __SIZEOF_PTHREAD_RWLOCK_T 32 -# define __SIZEOF_PTHREAD_BARRIER_T 20 -#endif -#define __SIZEOF_PTHREAD_MUTEXATTR_T 4 -#define __SIZEOF_PTHREAD_COND_T 48 -#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 -#define __SIZEOF_PTHREAD_BARRIERATTR_T 4 - -/* Definitions for internal mutex struct. */ -#define __PTHREAD_COMPAT_PADDING_MID -#define __PTHREAD_COMPAT_PADDING_END -#define __PTHREAD_MUTEX_LOCK_ELISION 0 -#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64) -#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64) - -#define __LOCK_ALIGNMENT -#define __ONCE_ALIGNMENT - -struct __pthread_rwlock_arch_t -{ - unsigned int __readers; - unsigned int __writers; - unsigned int __wrphase_futex; - unsigned int __writers_futex; - unsigned int __pad3; - unsigned int __pad4; -#if __WORDSIZE == 64 - int __cur_writer; - int __shared; - unsigned long int __pad1; - unsigned long int __pad2; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned int __flags; -#else - unsigned char __pad1; - unsigned char __pad2; - unsigned char __shared; - /* FLAGS must stay at this position in the structure to maintain - binary compatibility. */ - unsigned char __flags; - int __cur_writer; -#endif -}; - -#define __PTHREAD_RWLOCK_ELISION_EXTRA 0 - -#endif /* bits/pthreadtypes.h */ diff --git a/lib/std/fs.zig b/lib/std/fs.zig index 1a02cd5b6b..02df5fae0f 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -501,7 +501,9 @@ pub const Dir = struct { }, .linux => struct { dir: Dir, - buf: [8192]u8, // TODO align(@alignOf(os.dirent64)), + // The if guard is solely there to prevent compile errors from missing `os.linux.dirent64` + // definition when compiling for other OSes. It doesn't do anything when compiling for Linux. + buf: [8192]u8 align(if (builtin.os.tag != .linux) 1 else @alignOf(os.linux.dirent64)), index: usize, end_index: usize, diff --git a/lib/std/os/bits/linux/errno-sparc.zig b/lib/std/os/bits/linux/errno-sparc.zig index bbeabaaef0..94b696fc35 100644 --- a/lib/std/os/bits/linux/errno-sparc.zig +++ b/lib/std/os/bits/linux/errno-sparc.zig @@ -52,6 +52,7 @@ pub const ENOPROTOOPT = 42; pub const EPROTONOSUPPORT = 43; pub const ESOCKTNOSUPPORT = 44; pub const EOPNOTSUPP = 45; +pub const ENOTSUP = EOPNOTSUPP; pub const EPFNOSUPPORT = 46; pub const EAFNOSUPPORT = 47; pub const EADDRINUSE = 48; diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index b0cf37553d..d5500d516c 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -294,7 +294,17 @@ comptime { @export(@import("compiler_rt/sparc.zig")._Qp_fgt, .{ .name = "_Qp_fgt", .linkage = linkage }); @export(@import("compiler_rt/sparc.zig")._Qp_fge, .{ .name = "_Qp_fge", .linkage = linkage }); + @export(@import("compiler_rt/sparc.zig")._Qp_itoq, .{ .name = "_Qp_itoq", .linkage = linkage }); + @export(@import("compiler_rt/sparc.zig")._Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = linkage }); + @export(@import("compiler_rt/sparc.zig")._Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = linkage }); + @export(@import("compiler_rt/sparc.zig")._Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = linkage }); + @export(@import("compiler_rt/sparc.zig")._Qp_stoq, .{ .name = "_Qp_stoq", .linkage = linkage }); @export(@import("compiler_rt/sparc.zig")._Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = linkage }); + @export(@import("compiler_rt/sparc.zig")._Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = linkage }); + @export(@import("compiler_rt/sparc.zig")._Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = linkage }); + @export(@import("compiler_rt/sparc.zig")._Qp_qtox, .{ .name = "_Qp_qtox", .linkage = linkage }); + @export(@import("compiler_rt/sparc.zig")._Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = linkage }); + @export(@import("compiler_rt/sparc.zig")._Qp_qtos, .{ .name = "_Qp_qtos", .linkage = linkage }); @export(@import("compiler_rt/sparc.zig")._Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage }); } diff --git a/lib/std/special/compiler_rt/sparc.zig b/lib/std/special/compiler_rt/sparc.zig index e66bb25886..87eed4c967 100644 --- a/lib/std/special/compiler_rt/sparc.zig +++ b/lib/std/special/compiler_rt/sparc.zig @@ -68,12 +68,52 @@ pub fn _Qp_fge(a: *f128, b: *f128) callconv(.C) bool { return cmp == @enumToInt(FCMP.Greater) or cmp == @enumToInt(FCMP.Equal); } -// Casting +// Conversion + +pub fn _Qp_itoq(c: *f128, a: i32) callconv(.C) void { + c.* = @import("floatsiXf.zig").__floatsitf(a); +} + +pub fn _Qp_uitoq(c: *f128, a: u32) callconv(.C) void { + c.* = @import("floatunsitf.zig").__floatunsitf(a); +} + +pub fn _Qp_xtoq(c: *f128, a: i64) callconv(.C) void { + c.* = @import("floatditf.zig").__floatditf(a); +} + +pub fn _Qp_uxtoq(c: *f128, a: u64) callconv(.C) void { + c.* = @import("floatunditf.zig").__floatunditf(a); +} + +pub fn _Qp_stoq(c: *f128, a: f32) callconv(.C) void { + c.* = @import("extendXfYf2.zig").__extendsftf2(a); +} pub fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void { c.* = @import("extendXfYf2.zig").__extenddftf2(a); } +pub fn _Qp_qtoi(a: *f128) callconv(.C) i32 { + return @import("fixtfsi.zig").__fixtfsi(a.*); +} + +pub fn _Qp_qtoui(a: *f128) callconv(.C) u32 { + return @import("fixunstfsi.zig").__fixunstfsi(a.*); +} + +pub fn _Qp_qtox(a: *f128) callconv(.C) i64 { + return @import("fixtfdi.zig").__fixtfdi(a.*); +} + +pub fn _Qp_qtoux(a: *f128) callconv(.C) u64 { + return @import("fixunstfdi.zig").__fixunstfdi(a.*); +} + +pub fn _Qp_qtos(a: *f128) callconv(.C) f32 { + return @import("truncXfYf2.zig").__trunctfsf2(a.*); +} + pub fn _Qp_qtod(a: *f128) callconv(.C) f64 { return @import("truncXfYf2.zig").__trunctfdf2(a.*); } diff --git a/src/glibc.zig b/src/glibc.zig index 6b288ac46d..04673e639b 100644 --- a/src/glibc.zig +++ b/src/glibc.zig @@ -446,10 +446,14 @@ fn start_asm_path(comp: *Compilation, arena: *Allocator, basename: []const u8) ! try result.appendSlice(comp.zig_lib_directory.path.?); try result.appendSlice(s ++ "libc" ++ s ++ "glibc" ++ s ++ "sysdeps" ++ s); if (is_sparc) { - if (is_64) { - try result.appendSlice("sparc" ++ s ++ "sparc64"); + if (mem.eql(u8, basename, "crti.S") or mem.eql(u8, basename, "crtn.S")) { + try result.appendSlice("sparc"); } else { - try result.appendSlice("sparc" ++ s ++ "sparc32"); + if (is_64) { + try result.appendSlice("sparc" ++ s ++ "sparc64"); + } else { + try result.appendSlice("sparc" ++ s ++ "sparc32"); + } } } else if (arch.isARM()) { try result.appendSlice("arm");