authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-14 15:21:17-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2021-05-14 15:21:17-04:00
log826d833416be0fa696cbe8785173997338e185bb
tree25567543887dcd5de646593a66a2d52b3683326d
parenta52e47230718c6e38dfd84ac0571a597ecd9719f
parent90a54f06e507e11ccf07c1378fe4a12b002ec2bd
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #8746 from koachan/sparc64-fixes

Various Linux/SPARCv9 fixes

6 files changed, 62 insertions(+), 86 deletions(-)

lib/libc/glibc/sysdeps/sparc/nptl/bits/pthreadtypes-arch.h deleted-81
......@@ -1,81 +0,0 @@
1/* Machine-specific pthread type layouts. SPARC version.
2 Copyright (C) 2003-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19#ifndef _BITS_PTHREADTYPES_ARCH_H
20#define _BITS_PTHREADTYPES_ARCH_H 1
21
22#include <bits/wordsize.h>
23
24#if __WORDSIZE == 64
25# define __SIZEOF_PTHREAD_ATTR_T 56
26# define __SIZEOF_PTHREAD_MUTEX_T 40
27# define __SIZEOF_PTHREAD_CONDATTR_T 4
28# define __SIZEOF_PTHREAD_RWLOCK_T 56
29# define __SIZEOF_PTHREAD_BARRIER_T 32
30#else
31# define __SIZEOF_PTHREAD_ATTR_T 36
32# define __SIZEOF_PTHREAD_MUTEX_T 24
33# define __SIZEOF_PTHREAD_CONDATTR_T 4
34# define __SIZEOF_PTHREAD_RWLOCK_T 32
35# define __SIZEOF_PTHREAD_BARRIER_T 20
36#endif
37#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
38#define __SIZEOF_PTHREAD_COND_T 48
39#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
40#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
41
42/* Definitions for internal mutex struct. */
43#define __PTHREAD_COMPAT_PADDING_MID
44#define __PTHREAD_COMPAT_PADDING_END
45#define __PTHREAD_MUTEX_LOCK_ELISION 0
46#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND (__WORDSIZE != 64)
47#define __PTHREAD_MUTEX_USE_UNION (__WORDSIZE != 64)
48
49#define __LOCK_ALIGNMENT
50#define __ONCE_ALIGNMENT
51
52struct __pthread_rwlock_arch_t
53{
54 unsigned int __readers;
55 unsigned int __writers;
56 unsigned int __wrphase_futex;
57 unsigned int __writers_futex;
58 unsigned int __pad3;
59 unsigned int __pad4;
60#if __WORDSIZE == 64
61 int __cur_writer;
62 int __shared;
63 unsigned long int __pad1;
64 unsigned long int __pad2;
65 /* FLAGS must stay at this position in the structure to maintain
66 binary compatibility. */
67 unsigned int __flags;
68#else
69 unsigned char __pad1;
70 unsigned char __pad2;
71 unsigned char __shared;
72 /* FLAGS must stay at this position in the structure to maintain
73 binary compatibility. */
74 unsigned char __flags;
75 int __cur_writer;
76#endif
77};
78
79#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
80
81#endif /* bits/pthreadtypes.h */
lib/std/fs.zig+3-1
......@@ -501,7 +501,9 @@ pub const Dir = struct {
501501 },
502502 .linux => struct {
503503 dir: Dir,
504 buf: [8192]u8, // TODO align(@alignOf(os.dirent64)),
504 // The if guard is solely there to prevent compile errors from missing `os.linux.dirent64`
505 // definition when compiling for other OSes. It doesn't do anything when compiling for Linux.
506 buf: [8192]u8 align(if (builtin.os.tag != .linux) 1 else @alignOf(os.linux.dirent64)),
505507 index: usize,
506508 end_index: usize,
507509
lib/std/os/bits/linux/errno-sparc.zig+1
......@@ -52,6 +52,7 @@ pub const ENOPROTOOPT = 42;
5252pub const EPROTONOSUPPORT = 43;
5353pub const ESOCKTNOSUPPORT = 44;
5454pub const EOPNOTSUPP = 45;
55pub const ENOTSUP = EOPNOTSUPP;
5556pub const EPFNOSUPPORT = 46;
5657pub const EAFNOSUPPORT = 47;
5758pub const EADDRINUSE = 48;
lib/std/special/compiler_rt.zig+10
......@@ -294,7 +294,17 @@ comptime {
294294 @export(@import("compiler_rt/sparc.zig")._Qp_fgt, .{ .name = "_Qp_fgt", .linkage = linkage });
295295 @export(@import("compiler_rt/sparc.zig")._Qp_fge, .{ .name = "_Qp_fge", .linkage = linkage });
296296
297 @export(@import("compiler_rt/sparc.zig")._Qp_itoq, .{ .name = "_Qp_itoq", .linkage = linkage });
298 @export(@import("compiler_rt/sparc.zig")._Qp_uitoq, .{ .name = "_Qp_uitoq", .linkage = linkage });
299 @export(@import("compiler_rt/sparc.zig")._Qp_xtoq, .{ .name = "_Qp_xtoq", .linkage = linkage });
300 @export(@import("compiler_rt/sparc.zig")._Qp_uxtoq, .{ .name = "_Qp_uxtoq", .linkage = linkage });
301 @export(@import("compiler_rt/sparc.zig")._Qp_stoq, .{ .name = "_Qp_stoq", .linkage = linkage });
297302 @export(@import("compiler_rt/sparc.zig")._Qp_dtoq, .{ .name = "_Qp_dtoq", .linkage = linkage });
303 @export(@import("compiler_rt/sparc.zig")._Qp_qtoi, .{ .name = "_Qp_qtoi", .linkage = linkage });
304 @export(@import("compiler_rt/sparc.zig")._Qp_qtoui, .{ .name = "_Qp_qtoui", .linkage = linkage });
305 @export(@import("compiler_rt/sparc.zig")._Qp_qtox, .{ .name = "_Qp_qtox", .linkage = linkage });
306 @export(@import("compiler_rt/sparc.zig")._Qp_qtoux, .{ .name = "_Qp_qtoux", .linkage = linkage });
307 @export(@import("compiler_rt/sparc.zig")._Qp_qtos, .{ .name = "_Qp_qtos", .linkage = linkage });
298308 @export(@import("compiler_rt/sparc.zig")._Qp_qtod, .{ .name = "_Qp_qtod", .linkage = linkage });
299309 }
300310
lib/std/special/compiler_rt/sparc.zig+41-1
......@@ -68,12 +68,52 @@ pub fn _Qp_fge(a: *f128, b: *f128) callconv(.C) bool {
6868 return cmp == @enumToInt(FCMP.Greater) or cmp == @enumToInt(FCMP.Equal);
6969}
7070
71// Casting
71// Conversion
72
73pub fn _Qp_itoq(c: *f128, a: i32) callconv(.C) void {
74 c.* = @import("floatsiXf.zig").__floatsitf(a);
75}
76
77pub fn _Qp_uitoq(c: *f128, a: u32) callconv(.C) void {
78 c.* = @import("floatunsitf.zig").__floatunsitf(a);
79}
80
81pub fn _Qp_xtoq(c: *f128, a: i64) callconv(.C) void {
82 c.* = @import("floatditf.zig").__floatditf(a);
83}
84
85pub fn _Qp_uxtoq(c: *f128, a: u64) callconv(.C) void {
86 c.* = @import("floatunditf.zig").__floatunditf(a);
87}
88
89pub fn _Qp_stoq(c: *f128, a: f32) callconv(.C) void {
90 c.* = @import("extendXfYf2.zig").__extendsftf2(a);
91}
7292
7393pub fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void {
7494 c.* = @import("extendXfYf2.zig").__extenddftf2(a);
7595}
7696
97pub fn _Qp_qtoi(a: *f128) callconv(.C) i32 {
98 return @import("fixtfsi.zig").__fixtfsi(a.*);
99}
100
101pub fn _Qp_qtoui(a: *f128) callconv(.C) u32 {
102 return @import("fixunstfsi.zig").__fixunstfsi(a.*);
103}
104
105pub fn _Qp_qtox(a: *f128) callconv(.C) i64 {
106 return @import("fixtfdi.zig").__fixtfdi(a.*);
107}
108
109pub fn _Qp_qtoux(a: *f128) callconv(.C) u64 {
110 return @import("fixunstfdi.zig").__fixunstfdi(a.*);
111}
112
113pub fn _Qp_qtos(a: *f128) callconv(.C) f32 {
114 return @import("truncXfYf2.zig").__trunctfsf2(a.*);
115}
116
77117pub fn _Qp_qtod(a: *f128) callconv(.C) f64 {
78118 return @import("truncXfYf2.zig").__trunctfdf2(a.*);
79119}
src/glibc.zig+7-3
......@@ -446,10 +446,14 @@ fn start_asm_path(comp: *Compilation, arena: *Allocator, basename: []const u8) !
446446 try result.appendSlice(comp.zig_lib_directory.path.?);
447447 try result.appendSlice(s ++ "libc" ++ s ++ "glibc" ++ s ++ "sysdeps" ++ s);
448448 if (is_sparc) {
449 if (is_64) {
450 try result.appendSlice("sparc" ++ s ++ "sparc64");
449 if (mem.eql(u8, basename, "crti.S") or mem.eql(u8, basename, "crtn.S")) {
450 try result.appendSlice("sparc");
451451 } else {
452 try result.appendSlice("sparc" ++ s ++ "sparc32");
452 if (is_64) {
453 try result.appendSlice("sparc" ++ s ++ "sparc64");
454 } else {
455 try result.appendSlice("sparc" ++ s ++ "sparc32");
456 }
453457 }
454458 } else if (arch.isARM()) {
455459 try result.appendSlice("arm");