From patchwork Thu Apr 2 16:29:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38707 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id E85DD388A031 for ; Thu, 2 Apr 2020 16:37:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E85DD388A031 IronPort-SDR: jeeRYBNTxRBPCxxsrob4Dy72GmW56/Gl2t8IMzn8ovGmUU1nMLmA13OLinvSS3oUySmfo7p6UF dYA8wuU8cK1JaGFQcyRW+YlSN34tfWEzIXp9kZmrLkcTzyKRaBOKOCnBE6pArYQRB5SmVVDxKq Rg0HzjnXcpYvyoPRgZllbjPsoGEvuyCTnqc0BIDb4zX5Xd/nzip8WRy6GqCs5iJAR02tVVtwDt rNAb/hqV9b3tvEfM9UUNgxXRLZIcBKIzvdOp+oA9CdHB8Uw5xRayLF7zqFVC09dQU9bJXqWbIg r/M= X-IronPort-AV: E=Sophos;i="5.72,336,1580745600"; d="scan'208";a="134426319" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Apr 2020 00:37:25 +0800 IronPort-SDR: ev5fIN10GH47qzAXnCEUlV7J9mG86+/Mym07vyKuypKRLp80JHJFjCCd+NvM/5JYmJ0tu+1Zlq hNTXTyONNIr/OQoQHFCitudoxxZpCWIFwFX35+7a07na0+ACTuvnQQ9V+l2JyTXHX4w9MFOlNk CFliW3KQEnMCNOnRLtJOMYdiiLxuBmd/s5iIl4Niz+Ix6XT78wSTOBm6paKj87DxzzPtTg4B59 mh28t0wVp+O1v0XEHO/U6gmzP5MWWKYIx0c0i1hvd9EEotg23yjTJIan21G8xA8IYG+l3210k/ CFFbC1bJFSCS6GKRUn45HjNq Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:28:17 -0700 IronPort-SDR: 3p0Moz1SQmynMX7XX3gjOF5yT1qq2rjsrhGqb4slqK7NC+5gtw82NGsNh0yeQsqdUf5jASt7Xd MIbVgyfXlE4ZOUF2FGy8D/3LzDfBZ/0/CX38j8gc++Zm3emLiD7OBlLnu4c6Xf3hr+y0HgVt6F sfTZsGHDplmH9tPwnqdKhhxmRIBBmyNn4+MTX2ZD5qBUi2XPvYRk4VoOTO4geZX3+17xYuB/cy FsMJxG9p+eJcV6Pd4A+M4RBnGX1NxmKRJoL6MpEGQJ4rr4i+Cg0b9Qok1kpZTcJyLDVgytx8fx I/s= WDCIronportException: Internal Received: from phd004806.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.43]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Apr 2020 09:37:25 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 01/18] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64 Date: Thu, 2 Apr 2020 09:29:31 -0700 Message-Id: <20200402162939.358617-2-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200402162939.358617-1-alistair.francis@wdc.com> References: <20200402162939.358617-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-25.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 16:37:30 -0000 Using the original glibc headers under bits/ let's make small modifications to use 64-bit time_t and off_t for both RV32 and RV64. For the typesizes.h, here are justifications for the changes from the generic version (based on Arnd's very helpful feedback): - All the !__USE_FILE_OFFSET64 types (__off_t, __ino_t, __rlim_t, ...) are changed to match the 64-bit replacements. - __time_t is defined to 64 bit, but no __time64_t is added. This makes sense as we don't have the time64 support for other 32-bit architectures yet, and it will be easy to change when that happens. - __suseconds_t is 64-bit. This matches what we use the kernel ABI for the few drivers that are relying on 'struct timeval' input arguments in ioctl, as well as the adjtimex system call. It means that timeval has to be defined without the padding, unlike timespec, which needs padding. --- .../unix/sysv/linux/riscv/bits/environments.h | 85 +++++++++++++++++++ sysdeps/unix/sysv/linux/riscv/bits/time64.h | 36 ++++++++ sysdeps/unix/sysv/linux/riscv/bits/timesize.h | 22 +++++ sysdeps/unix/sysv/linux/riscv/kernel_stat.h | 23 +++++ 4 files changed, 166 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/environments.h create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/time64.h create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/timesize.h create mode 100644 sysdeps/unix/sysv/linux/riscv/kernel_stat.h diff --git a/sysdeps/unix/sysv/linux/riscv/bits/environments.h b/sysdeps/unix/sysv/linux/riscv/bits/environments.h new file mode 100644 index 0000000000..c1768af17b --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/bits/environments.h @@ -0,0 +1,85 @@ +/* Copyright (C) 2019-2020 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 _UNISTD_H +# error "Never include this file directly. Use instead" +#endif + +#include + +/* This header should define the following symbols under the described + situations. A value `1' means that the model is always supported, + `-1' means it is never supported. Undefined means it cannot be + statically decided. + + _POSIX_V7_ILP32_OFF32 32bit int, long, pointers, and off_t type + _POSIX_V7_ILP32_OFFBIG 32bit int, long, and pointers and larger off_t type + + _POSIX_V7_LP64_OFF32 64bit long and pointers and 32bit off_t type + _POSIX_V7_LPBIG_OFFBIG 64bit long and pointers and large off_t type + + The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG, + _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32, + _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were + used in previous versions of the Unix standard and are available + only for compatibility. +*/ + +#if __WORDSIZE == 64 + +/* We can never provide environments with 32-bit wide pointers. */ +# define _POSIX_V7_ILP32_OFF32 -1 +# define _POSIX_V7_ILP32_OFFBIG -1 +# define _POSIX_V6_ILP32_OFF32 -1 +# define _POSIX_V6_ILP32_OFFBIG -1 +# define _XBS5_ILP32_OFF32 -1 +# define _XBS5_ILP32_OFFBIG -1 +/* We also have no use (for now) for an environment with bigger pointers + and offsets. */ +# define _POSIX_V7_LPBIG_OFFBIG -1 +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LPBIG_OFFBIG -1 + +/* By default we have 64-bit wide `long int', pointers and `off_t'. */ +# define _POSIX_V7_LP64_OFF64 1 +# define _POSIX_V6_LP64_OFF64 1 +# define _XBS5_LP64_OFF64 1 + +#else /* __WORDSIZE == 32 */ + +/* RISC-V requires 64-bit off_t + # undef _POSIX_V7_ILP32_OFF32 + # undef _POSIX_V6_ILP32_OFF32 + # undef _XBS5_ILP32_OFF32 + */ + +# define _POSIX_V7_ILP32_OFFBIG 1 +# define _POSIX_V6_ILP32_OFFBIG 1 +# define _XBS5_ILP32_OFFBIG 1 + +/* We can never provide environments with 64-bit wide pointers. */ +# define _POSIX_V7_LP64_OFF64 -1 +# define _POSIX_V7_LPBIG_OFFBIG -1 +# define _POSIX_V6_LP64_OFF64 -1 +# define _POSIX_V6_LPBIG_OFFBIG -1 +# define _XBS5_LP64_OFF64 -1 +# define _XBS5_LPBIG_OFFBIG -1 + +/* CFLAGS. */ +#define __ILP32_OFFBIG_CFLAGS "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" + +#endif /* __WORDSIZE == 32 */ diff --git a/sysdeps/unix/sysv/linux/riscv/bits/time64.h b/sysdeps/unix/sysv/linux/riscv/bits/time64.h new file mode 100644 index 0000000000..7ba0dd1cfd --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/bits/time64.h @@ -0,0 +1,36 @@ +/* bits/time64.h -- underlying types for __time64_t. Generic version. + Copyright (C) 2019-2020 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_TYPES_H +# error "Never include directly; use instead." +#endif + +#ifndef _BITS_TIME64_H +#define _BITS_TIME64_H 1 + +/* Define __TIME64_T_TYPE so that it is always a 64-bit type. */ + +#if __WORDSIZE == 64 +/* If we already have 64-bit time type then use it. */ +# define __TIME64_T_TYPE __TIME_T_TYPE +#else +/* Define a 64-bit time type alongsize the 32-bit one. */ +# define __TIME64_T_TYPE __SQUAD_TYPE +#endif + +#endif /* bits/time64.h */ diff --git a/sysdeps/unix/sysv/linux/riscv/bits/timesize.h b/sysdeps/unix/sysv/linux/riscv/bits/timesize.h new file mode 100644 index 0000000000..78394b7489 --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/bits/timesize.h @@ -0,0 +1,22 @@ +/* Bit size of the time_t type at glibc build time, general case. + Copyright (C) 2019-2020 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 + . */ + +#include + +/* RV32 and RV64 both use 64-bit time_t */ +#define __TIMESIZE 64 diff --git a/sysdeps/unix/sysv/linux/riscv/kernel_stat.h b/sysdeps/unix/sysv/linux/riscv/kernel_stat.h new file mode 100644 index 0000000000..25e698b9bf --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/kernel_stat.h @@ -0,0 +1,23 @@ +/* Copyright (C) 2019-2020 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 + . */ + +#include + +#define STAT_IS_KERNEL_STAT 1 + +#define XSTAT_IS_XSTAT64 1 +#define STATFS_IS_STATFS64 0 From patchwork Thu Apr 2 16:29:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38708 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id B95BF388A031 for ; Thu, 2 Apr 2020 16:37:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B95BF388A031 IronPort-SDR: +QbsxSKePkJ/KXkNqvJ0S5tBGXUlGZC8OS0G67mxxjTTMkSrrO1Z/LoO0v+9bFI8YjFyYO+y2s HggPeZAGuNNjGy2ALWTmGSlV/eizmf1wK+8+xt7iBAWd3fPlyFRXnTyMaKAScs1RFzIkycDJlf UnQottygnAuFFx6q/ocKXeKb1Jr01f9nr+gJsyiFbW1Xi1Bb+KOCPfur09Hp8IBYA6ZjrY/nr6 Lmk6UNDce02bkE1Bm3qVoRv8y0PzHCaqFO/K0AViYk64Hi7Nw4NHSssQZvsqhRz9r1jUPvX6nn ohg= X-IronPort-AV: E=Sophos;i="5.72,336,1580745600"; d="scan'208";a="134426320" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Apr 2020 00:37:26 +0800 IronPort-SDR: p2SylubwtcmmQv6OGpkzENIW1hflQ00EI9m22Z0osHXlAr/QIqprGh4jg7+yfwikomiChxQpCn /+qtE7qLjhZL6A7KsPI5z1ktGHPlzLL/BUkyQUN3sy6PmJps94a3crEB4m6vG3GbFlKTlIIXo4 6pu+Wj95E0i6uwbG23AMlaxUY9lKiMJTo4bqMPmzWNS5Qdc2AndmJGqA0lLzg5h83H4ryzaB8j OyCcW9IAO4Q8MnUnVZ98ddLjMMUd175sMpgsTkqVwjEIa0s0KLeztNki6FVC4QTOaAjaUWjeKd Jke1vEI3Yvph7yFMOc8cH7yk Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:28:17 -0700 IronPort-SDR: GOBCde2GAHVwehiHb1ddnqeRAzySiAPRfqtOGtHz8gfwsQJpil9DEcwSmGLBl2naR1t9LeuQDA J3QEXLJhC/IyAK7wD8paNUHTaaDqSeuP9POygXf83qTTd+kjL+Y1xUlCn13+Cl8aTwUex/F7C1 HVtH/HJppCjvcjWp0n790Yu4V009wLxSTBM3dwwT7UQ/aq39vieE2t5HCsUeJX/RoGhAp/MgYE HzlwRzdK4lSWHyqgtJOxx//sXExowr81r4FXPNEzQLVf6uxBCxCK3C92asjut4KboC1Csnrv3a yO0= WDCIronportException: Internal Received: from phd004806.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.43]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Apr 2020 09:37:25 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 02/18] RISC-V: Define __NR_* as __NR_*_time64/64 for 32-bit Date: Thu, 2 Apr 2020 09:29:32 -0700 Message-Id: <20200402162939.358617-3-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200402162939.358617-1-alistair.francis@wdc.com> References: <20200402162939.358617-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-26.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 16:37:31 -0000 --- sysdeps/unix/sysv/linux/riscv/sysdep.h | 61 ++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index 83e4adf6a2..aa61e8b04d 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -116,6 +116,67 @@ #include +#if __riscv_xlen == 32 +/* Define the __NR_futex as __NR_futex64 as RV32 doesn't have a + * __NR_futex syscall. + */ +# ifndef __NR_futex +# define __NR_futex __NR_futex_time64 +# endif + +# ifndef __NR_rt_sigtimedwait +# define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64 +# endif + +# ifndef __NR_ppoll +# define __NR_ppoll __NR_ppoll_time64 +# endif + +# ifndef __NR_utimensat +# define __NR_utimensat __NR_utimensat_time64 +# endif + +# ifndef __NR_pselect6 +# define __NR_pselect6 __NR_pselect6_time64 +# endif + +# ifndef __NR_recvmmsg +# define __NR_recvmmsg __NR_recvmmsg_time64 +# endif + +# ifndef __NR_semtimedop +# define __NR_semtimedop __NR_semtimedop_time64 +# endif + +# ifndef __NR_mq_timedreceive +# define __NR_mq_timedreceive __NR_mq_timedreceive_time64 +# endif + +# ifndef __NR_mq_timedsend +# define __NR_mq_timedsend __NR_mq_timedsend_time64 +# endif + +# ifndef __NR_clock_getres +# define __NR_clock_getres __NR_clock_getres_time64 +# endif + +# ifndef __NR_timerfd_settime +# define __NR_timerfd_settime __NR_timerfd_settime64 +# endif + +# ifndef __NR_timerfd_gettime +# define __NR_timerfd_gettime __NR_timerfd_gettime64 +# endif + +# ifndef __NR_sched_rr_get_interval +# define __NR_sched_rr_get_interval __NR_sched_rr_get_interval_time64 +# endif + +# ifndef __NR_clock_adjtime +# define __NR_clock_adjtime __NR_clock_adjtime64 +# endif +#endif /* __riscv_xlen == 32 */ + #undef SYS_ify #define SYS_ify(syscall_name) __NR_##syscall_name From patchwork Thu Apr 2 16:29:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38709 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id 48CE4388A039 for ; Thu, 2 Apr 2020 16:37:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 48CE4388A039 IronPort-SDR: g+z/0os/aPY8s8Z2H9iA4NimNTWEwH9V80kz++nd4ubOFl+btje0MIyRyuU8xwoorvfjIuK7Ok GoPU7KedTgPMay+ENM7IncqFpaJ9HY4k9KuWkZofOte14uYt0Emg7QAIkd39f6GDOzmfcUobyP dG5h2U8mm8QzXGTFaEcYmxgmOw+4wLiRbQBpT1fYA8HgfftC31y5/9c6bH8NDh1DsNmEfyg289 lECndbNcYM2VSaDYyw4FIuZ6LAjuSrciotRvWDTWkmsgzOy1SUnv26CCWN0goWahj0Gawdc9Jh q5s= X-IronPort-AV: E=Sophos;i="5.72,336,1580745600"; d="scan'208";a="134426324" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Apr 2020 00:37:26 +0800 IronPort-SDR: YzAriioXw0vQGOYq3G5a3oMF7hOcrntD2/XiultpMNj4to5uo9Yo2pOlxgblxp2HQsyvrAsz4A gQhZZno3vGHFACJ/YhDxIRzYH45MYN8fwPraHccG24tWSEHUWy58docd87w8O1tgP8c3/OlRdC 70+AFF3ItAQ4+8l1As3b4ZYwwR9w1t90P9ux0n5piRCfr/bky6p2s6VTiTgml3/VWNZRsFZE6Q EkCagpgAeZLc/LDa54ZaMjScEyc0NelCtdKQ2VCQ1HrZ64N2L+FkKn8czOp1J2FyC9pTNorSsg xsYa0fn/f1tdkbD3FSRAeSQl Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:28:17 -0700 IronPort-SDR: tZGMMtpFQ1eWKy4LcGvL1zQLr+SS8TPkhirDDHTXLvDWATmQ6p1YX8IcRcIsAma8tQQk4H8aYt 3neVNs/MTIwtYSmwqGsXULMHQaK7UbnLczeK/8ehT0UQvwqWS5Mtj+Lgoh0YR9G/ZZrO0WLjer TwmTS6Z2FlfMcQA9s6Mb23Hf2XX+w4ar/ldlMFPtm0MBkR9uO5pM6mjEm4nltmPRB4p1a8hVKJ GENeptqhVTsIBoxmjagAwY+yAO8NS7sk8A/axwkHTz2wgx6kko3Toc1L1dCiLUoRsjtH/rSAbO nOA= WDCIronportException: Internal Received: from phd004806.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.43]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Apr 2020 09:37:25 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 03/18] RISC-V: Add support for 32-bit vDSO calls Date: Thu, 2 Apr 2020 09:29:33 -0700 Message-Id: <20200402162939.358617-4-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200402162939.358617-1-alistair.francis@wdc.com> References: <20200402162939.358617-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-26.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 16:37:32 -0000 --- sysdeps/unix/sysv/linux/riscv/sysdep.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index aa61e8b04d..9f6ed2001b 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -182,14 +182,21 @@ #ifndef __ASSEMBLER__ -# define VDSO_NAME "LINUX_4.15" -# define VDSO_HASH 182943605 +# if __riscv_xlen == 32 +# define VDSO_NAME "LINUX_5.4" +# define VDSO_HASH 61765876 /* List of system calls which are supported as vsyscalls. */ -# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres" -# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime" -# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" -# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" +# else +# define VDSO_NAME "LINUX_4.15" +# define VDSO_HASH 182943605 + +/* List of system calls which are supported as vsyscalls. */ +# define HAVE_CLOCK_GETRES64_VSYSCALL "__vdso_clock_getres" +# define HAVE_CLOCK_GETTIME64_VSYSCALL "__vdso_clock_gettime" +# define HAVE_GETTIMEOFDAY_VSYSCALL "__vdso_gettimeofday" +# define HAVE_GETCPU_VSYSCALL "__vdso_getcpu" +# endif # define INTERNAL_SYSCALL(name, nr, args...) \ internal_syscall##nr (SYS_ify (name), args) From patchwork Thu Apr 2 16:29:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38711 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id 11B32388A031 for ; Thu, 2 Apr 2020 16:37:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 11B32388A031 IronPort-SDR: wOwF3rrE208OZrTfOihNTHvwBYkPlVOEpuqSEFPUiGeybf8fmYP4bi/Schn0aUzp+96an1ijxs spOcJOtLEGyGaHYNxbJT9UMG3fyTX0XDxOdjSS1FOIGtif8dJ8vFYC9TMfoDyq+yuKrNVMFdum faswPcFFOV3bNmzMj6JiL3XjR/SsyIcDwGAx8Yp9yBZUoBACvlLkYmyEn9tPzuAeVTPD0Mo3o/ DKfUpaYluFwPaJJJ3+7TWyWjKGO7s6Ez6b9cJmm5equxeUIbLDQGwSDCz1AuGcZ0xJZqAY6r6y WnM= X-IronPort-AV: E=Sophos;i="5.72,336,1580745600"; d="scan'208";a="134426327" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Apr 2020 00:37:26 +0800 IronPort-SDR: j7/xI3TFSEMXO/O8laOHUv585bSvP1SIDMe68wUUj4hd+3GsUF+lJpiAm/jFyjmbk55lvtMtkt vgalKW3OTJC0xoaFXi8nEiGqJXMMGeaFK+i/c/6vR2RQvTsQKFON/63I2ymFcLOrSSq5zmLFM+ DxH4DP81aZjs5qiqWa2NBz+B3asSd7fkanwa/PcxKcN2l177LAWz5rxjd1+pZn8plhlzwQDEM6 Zoe3cc41D9qYBjlk82wXFkTfwPLxK6WM7n6H1W6fQ1SrtL45rVj1mg3112dcFBIOF+nRPxh8V3 qg3O533vNddOQbXTJ4ijd2LC Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:28:17 -0700 IronPort-SDR: XE5h0IaCPm/qM1Sv/BYDv7i9XNibXAtAsukKexeJR0GOqFuRG0ORe8f2wot73GBv5of1txgDEA 0xPkCcvRtQUXbrDv6YZQv2+rRciVVVXecplokHX/LfcN94cxACJmZDrlwRvvvxYLvijhVcrr27 Q16/6VzGE7t8xQy27lv6eqyxblkVLFKfsQOL4Qavrkz1xA8RCsAMWgizj2+EgEp3p6MDFLRhOt vYE71L4WvAKHgYLdmmA5R0Y9DxTn+so8CHNeRbW0X69EAT7i5X9N0zux+Bhea1MgmrofIDWWnR /LU= WDCIronportException: Internal Received: from phd004806.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.43]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Apr 2020 09:37:26 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 04/18] RISC-V: Add socket-constants.h for RV32 Date: Thu, 2 Apr 2020 09:29:34 -0700 Message-Id: <20200402162939.358617-5-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200402162939.358617-1-alistair.francis@wdc.com> References: <20200402162939.358617-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-25.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 16:37:33 -0000 Add the latest versionf of the socket-constants.h based on new Linux --- .../sysv/linux/riscv/bits/socket-constants.h | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/riscv/bits/socket-constants.h diff --git a/sysdeps/unix/sysv/linux/riscv/bits/socket-constants.h b/sysdeps/unix/sysv/linux/riscv/bits/socket-constants.h new file mode 100644 index 0000000000..7ecdfcbb61 --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/bits/socket-constants.h @@ -0,0 +1,46 @@ +/* Socket constants which vary among Linux architectures. Version for RV32. + Copyright (C) 2020 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 _SYS_SOCKET_H +# error "Never include directly; use instead." +#endif + +#define SOL_SOCKET 1 +#define SO_ACCEPTCONN 30 +#define SO_BROADCAST 6 +#define SO_DONTROUTE 5 +#define SO_ERROR 4 +#define SO_KEEPALIVE 9 +#define SO_LINGER 13 +#define SO_OOBINLINE 10 +#define SO_RCVBUF 8 +#define SO_RCVLOWAT 18 +#if __riscv_xlen == 32 +# define SO_RCVTIMEO 66 +#else +# define SO_RCVTIMEO 20 +#endif +#define SO_REUSEADDR 2 +#define SO_SNDBUF 7 +#define SO_SNDLOWAT 19 +#if __riscv_xlen == 32 +# define SO_SNDTIMEO 67 +#else +# define SO_SNDTIMEO 21 +#endif +#define SO_TYPE 3 From patchwork Thu Apr 2 16:29:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38712 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id 994B3388B800 for ; Thu, 2 Apr 2020 16:37:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 994B3388B800 IronPort-SDR: RIjUYoZSGvcDLYExpTIhIa215PsxWdIefOJMvDTlvOUqCqWd9Ylooch5H3iJrepFBAevYbjVSz sbFK6R0WhlsA5b67F0IKtvIFOhLbjeEepAe+8SWa8d9pj6KdIkNipbEIywX5v9/e2FMcBUIAfV IWoleF+n1RvTw/uglWrhySELudGWdv+VQkL8O78OWanVaWGl4iJUzPfwfOB3fJsUBf0Zu1ukgN ERc2qR6eb82nM6wmP5acE69snoDm3vbt5LWeItWO3wXInif7JNdQ04dN9in4Kw91EOYnfshMci 8dY= X-IronPort-AV: E=Sophos;i="5.72,336,1580745600"; d="scan'208";a="134426328" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Apr 2020 00:37:26 +0800 IronPort-SDR: 7HQrrQGNUbAIJK+1dHro93ua0cWgJdmSAdIvQllv+CoI7Kt2KcHPGa8X5J7sENrnnR85TdG7f/ GHxgI37Yo/3tCZu8Kps5XDXyLLLRm2jLTCBJMdb68N3RRUKjRyFzLoiDRPdd6RaT935d7VYsUI qzIB1g42NRZ0r8JxDQtrazaMSyqhs8HSCNybpl82Dc+104NGPu5fM2Tmajjew7mKWYPpuRH5nw n2H3eGezLBW52p6/mHZwL2z3NO6klGq6Dn/+LpiTxW4empFGlNgmnt9qsIurNCsKNg9sjSi0/x W/9Jc0l3hdeoCBR/NH5Ymsuq Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:28:18 -0700 IronPort-SDR: 4n07H9EqTTEFKA2weZaLOvxLpQxIL8yNgzG2jJkKJYlRxf/zwp9LkokjgrKj/Amej5KAs5+5OI QHUk9wyM1K/hL0J+vKVCjFpsd3KrI8TXnW2N4xgePTukejwkye1jpt6H5M8azjtawVc3PdH9+Y pYI/a70V5HWJivIYKXlj+hjZMLkbX8bm5T932lvKstnb1tMifnqiA+m6r5fQ4GnsWSG4sZQg9B hXyK7hMGjTraoWyFcxKMUqsWIr66MGH0PvWsLBQH+l9IvkozOpevBA9OatzAEygXoV1xwcK6Vu 1dQ= WDCIronportException: Internal Received: from phd004806.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.43]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Apr 2020 09:37:26 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Zong Li Subject: [PATCH 05/18] RISC-V: Support dynamic loader for the 32-bit Date: Thu, 2 Apr 2020 09:29:35 -0700 Message-Id: <20200402162939.358617-6-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200402162939.358617-1-alistair.francis@wdc.com> References: <20200402162939.358617-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-26.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 16:37:33 -0000 From: Zong Li Add the LD_SO_ABI definition for RISC-V 32-bit. --- sysdeps/unix/sysv/linux/riscv/ldconfig.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/unix/sysv/linux/riscv/ldconfig.h b/sysdeps/unix/sysv/linux/riscv/ldconfig.h index 3d7065b293..35badb7cf0 100644 --- a/sysdeps/unix/sysv/linux/riscv/ldconfig.h +++ b/sysdeps/unix/sysv/linux/riscv/ldconfig.h @@ -24,7 +24,7 @@ #if __riscv_xlen == 64 # define LD_SO_ABI "riscv64-lp64" #else -# error "rv32i-based targets are not supported" +# define LD_SO_ABI "riscv32-ilp32" #endif #define SYSDEP_KNOWN_INTERPRETER_NAMES \ From patchwork Thu Apr 2 16:29:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38713 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id E3DD5388B803 for ; Thu, 2 Apr 2020 16:37:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E3DD5388B803 IronPort-SDR: 6IaA41idLyXUxUeJnI09DGscXh+7OH/DP+dVd2S5GYQj/D34S5WDQ59q8TkK/ytrAS2Mqfv4Vd 9psnd2MVosDlv1qHa6o5lsDap5qUl3dvNn7p3eKQkJ58a9gmcJ1UC3fqf+hsFQCJNIMH4c0p7b S8yZ4061PGMBLAoXQWvnpg9e4LbJWYPwKHlmog6EPH8hRgBMiL285Ba0Y4eGeJirf0EHnIFYUR NIwsNgUqRoMw5s4X7r7C15DNVvk6RkL6NyshnPveIbyZ11H+NLu+ptHc0UXVmeYVvgj1oTS/j3 RGU= X-IronPort-AV: E=Sophos;i="5.72,336,1580745600"; d="scan'208";a="134426331" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Apr 2020 00:37:26 +0800 IronPort-SDR: m0F02wZ2PvH84zzQfd7fA7vhwLdrceBmCijUs4C4aSaqfcE19kVMsUO+M7VdFL+Y6OJoSt0n95 cemmZPjR+mJW6fZYNlTR+tIL6bs6S2VVO7+v6o5Jrb8mDg+pZgSLYxZPoGCoZEMO/0BR2nsZ2E cia02U8KBS9IvgsUf2dFn75F435cKBqlk9V6HIY/H0hGgD3jkqnTKRxO3KOhXb1K438Ot5PpKG WXsBM1FhrnN2mUwxOg3EBvz8iIL3f1sW5q2Pzffy+OO7H4Nuev/JV+u+/5aLBqyojIkaoqBvF9 HH6SPBhp2uILzkTvllg2j8zE Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:28:18 -0700 IronPort-SDR: sLbzi1klEZjLkxr/Am5h+RCddpaSbDqaF+tNfX/dzjx6z2u1eodt49eYDme77Yw/DrUfg6Vxkl dRKjp5/nl8h6+3/PgXF5BveA92bXMK1b/RAvIwGe22z7Pru1PJQsMWIiTXdXupLea7CwtZpGpU G+s4WkZtZVvJjrYfpsWYdD5VSt1cC4Tua5b8yjZeGc/9IzSaZYgvZG0LzWiPysCN1rUpoHZQhI N0vJMmtjw14FLno8tUKoIwZBbIXnvhUEv2eyIqsyEOwEH1oR7g04HGmE6sPI3C8N6/N02ZQW44 aM4= WDCIronportException: Internal Received: from phd004806.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.43]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Apr 2020 09:37:26 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Zong Li Subject: [PATCH 06/18] RISC-V: Add path of library directories for the 32-bit Date: Thu, 2 Apr 2020 09:29:36 -0700 Message-Id: <20200402162939.358617-7-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200402162939.358617-1-alistair.francis@wdc.com> References: <20200402162939.358617-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-26.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 16:37:34 -0000 From: Zong Li For the recommand of 64 bit version, we add the libraries path of 32 bit in this patch. The status of RV32 binaries under RV64 kernels is that the ISA optionally supports having different XLEN for user and supervisor modes, but AFAIK there's no silicon that implements this feature, and the Linux kernel doesn't support it yet. For the recommand of 64 bit version, we add the libraries path of 32 bit in this patch. This includes a fix to avoid an out of bound array check when building with GCC 8.2. --- sysdeps/unix/sysv/linux/riscv/dl-cache.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/sysdeps/unix/sysv/linux/riscv/dl-cache.h b/sysdeps/unix/sysv/linux/riscv/dl-cache.h index c297dfe84f..60fc172edb 100644 --- a/sysdeps/unix/sysv/linux/riscv/dl-cache.h +++ b/sysdeps/unix/sysv/linux/riscv/dl-cache.h @@ -34,6 +34,8 @@ RISC-V, libraries can be found in paths ending in: - /lib64/lp64d - /lib64/lp64 + - /lib32/ilp32d + - /lib32/ilp32 - /lib (only ld.so) so this will add all of those paths. @@ -49,9 +51,16 @@ do \ { \ size_t len = strlen (dir); \ - char path[len + 9]; \ + char path[len + 10]; \ memcpy (path, dir, len + 1); \ - if (len >= 12 && ! memcmp(path + len - 12, "/lib64/lp64d", 12)) \ + if (len >= 13 && ! memcmp(path + len - 13, "/lib32/ilp32d", 13)) \ + { \ + len -= 9; \ + path[len] = '\0'; \ + } \ + if (len >= 12 \ + && (! memcmp(path + len - 12, "/lib32/ilp32", 12) \ + || ! memcmp(path + len - 12, "/lib64/lp64d", 12))) \ { \ len -= 8; \ path[len] = '\0'; \ @@ -64,6 +73,10 @@ add_dir (path); \ if (len >= 4 && ! memcmp(path + len - 4, "/lib", 4)) \ { \ + memcpy (path + len, "32/ilp32d", 10); \ + add_dir (path); \ + memcpy (path + len, "32/ilp32", 9); \ + add_dir (path); \ memcpy (path + len, "64/lp64d", 9); \ add_dir (path); \ memcpy (path + len, "64/lp64", 8); \ From patchwork Thu Apr 2 16:29:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38715 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id A102D388A031 for ; Thu, 2 Apr 2020 16:37:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A102D388A031 IronPort-SDR: FniYW8xCkMrkgCV8dat2eoYu5s4edNpELyK4eu40bRb9zc1kDTZ+ONiKZl6widSUsKZ0+gTXXf pLZdGsEWFVwDPA4HvoQXR1KUNEPAl+FcksMaVKB9H7JpYd7KlKvMmZT8BzKCXrCJVeeKSX6QcC TxZwI+yJgqLIV6JXE2iUe2Y/3hKWzd08bs6y07DMnfw2WivRyDAphaH0an+SFGCosPol8YlZXJ 3Fdu9VhaF0cvIWplT/zIrlRl6qIgAuV84ba4qu4cR8ZwuhiWRbG6L7X7jT6rHbJU+q9oMoTOYB X3w= X-IronPort-AV: E=Sophos;i="5.72,336,1580745600"; d="scan'208";a="134426332" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Apr 2020 00:37:27 +0800 IronPort-SDR: VNJomzfea/4QKkK0osIqimn5TQ2i09FanHLNIy5Ss5a7llGmMmNFKHtETdfx8zVbBfxrtGYrlG DSLE5xq3Mvas9Ll+tTVUqOoO/+gJTDUbNhhJZkeDdqNwpsH+HyueYOQ9Av54NV5DfUEmJlnAll Ei0hAtneiNWoGpxNY6JK0h1glwNgNJ0dR3QDsLx0HHObZ5gZgcCMaSd8J98IA/6TH87GstK5A+ wQ01XHipRvgOJ+UGyqUP93kRXhvrdA9daeeatsHAM/tV96ypLV8XiciZU47GG3fdm2ISQxPsJs 0SV/jfYIwrxIRgvHPd6fjeyQ Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:28:18 -0700 IronPort-SDR: tFUic9lfkQv1XRMpcwcpuOVTs3IPlh0vhXdiUNDNX8J6n8CKfVFMq4tY+evc1CE2HH5HGGxCCD Zeb7HQkcwdIyWMK4i39I1D9a63zxxblBGZhn1tyLC6jLz3yPlY+BOZg5CNxlXiWY2k2oF2OC1Z scdxAreLn0DOZUhYyufkPzDFjenHx5WzmLGq/Ti+f1O60bw/xYVd84UlB7nBNCcu7M39XbGSwz E7fiiLRZ9z0zk7nW+M8aID2YbybP4EYDQF5eCChbZwC/nCEcsXyPNZFEi2EybqRQU67+qYUjDb i7c= WDCIronportException: Internal Received: from phd004806.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.43]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Apr 2020 09:37:26 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 07/18] RISC-V: Add arch-syscall.h for RV32 Date: Thu, 2 Apr 2020 09:29:37 -0700 Message-Id: <20200402162939.358617-8-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200402162939.358617-1-alistair.francis@wdc.com> References: <20200402162939.358617-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-25.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 16:37:35 -0000 --- .../unix/sysv/linux/riscv/rv32/arch-syscall.h | 283 ++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h new file mode 100644 index 0000000000..9f9a2d5912 --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/rv32/arch-syscall.h @@ -0,0 +1,283 @@ +/* AUTOGENERATED by update-syscall-lists.py. */ +#define __NR_accept 202 +#define __NR_accept4 242 +#define __NR_acct 89 +#define __NR_add_key 217 +#define __NR_bind 200 +#define __NR_bpf 280 +#define __NR_brk 214 +#define __NR_capget 90 +#define __NR_capset 91 +#define __NR_chdir 49 +#define __NR_chroot 51 +#define __NR_clock_adjtime64 405 +#define __NR_clock_getres_time64 406 +#define __NR_clock_gettime64 403 +#define __NR_clock_nanosleep_time64 407 +#define __NR_clock_settime64 404 +#define __NR_clone 220 +#define __NR_close 57 +#define __NR_connect 203 +#define __NR_copy_file_range 285 +#define __NR_delete_module 106 +#define __NR_dup 23 +#define __NR_dup3 24 +#define __NR_epoll_create1 20 +#define __NR_epoll_ctl 21 +#define __NR_epoll_pwait 22 +#define __NR_eventfd2 19 +#define __NR_execve 221 +#define __NR_execveat 281 +#define __NR_exit 93 +#define __NR_exit_group 94 +#define __NR_faccessat 48 +#define __NR_fadvise64_64 223 +#define __NR_fallocate 47 +#define __NR_fanotify_init 262 +#define __NR_fanotify_mark 263 +#define __NR_fchdir 50 +#define __NR_fchmod 52 +#define __NR_fchmodat 53 +#define __NR_fchown 55 +#define __NR_fchownat 54 +#define __NR_fcntl64 25 +#define __NR_fdatasync 83 +#define __NR_fgetxattr 10 +#define __NR_finit_module 273 +#define __NR_flistxattr 13 +#define __NR_flock 32 +#define __NR_fremovexattr 16 +#define __NR_fsconfig 431 +#define __NR_fsetxattr 7 +#define __NR_fsmount 432 +#define __NR_fsopen 430 +#define __NR_fspick 433 +#define __NR_fstatfs64 44 +#define __NR_fsync 82 +#define __NR_ftruncate64 46 +#define __NR_futex_time64 422 +#define __NR_get_mempolicy 236 +#define __NR_get_robust_list 100 +#define __NR_getcpu 168 +#define __NR_getcwd 17 +#define __NR_getdents64 61 +#define __NR_getegid 177 +#define __NR_geteuid 175 +#define __NR_getgid 176 +#define __NR_getgroups 158 +#define __NR_getitimer 102 +#define __NR_getpeername 205 +#define __NR_getpgid 155 +#define __NR_getpid 172 +#define __NR_getppid 173 +#define __NR_getpriority 141 +#define __NR_getrandom 278 +#define __NR_getresgid 150 +#define __NR_getresuid 148 +#define __NR_getrusage 165 +#define __NR_getsid 156 +#define __NR_getsockname 204 +#define __NR_getsockopt 209 +#define __NR_gettid 178 +#define __NR_getuid 174 +#define __NR_getxattr 8 +#define __NR_init_module 105 +#define __NR_inotify_add_watch 27 +#define __NR_inotify_init1 26 +#define __NR_inotify_rm_watch 28 +#define __NR_io_cancel 3 +#define __NR_io_destroy 1 +#define __NR_io_pgetevents_time64 416 +#define __NR_io_setup 0 +#define __NR_io_submit 2 +#define __NR_io_uring_enter 426 +#define __NR_io_uring_register 427 +#define __NR_io_uring_setup 425 +#define __NR_ioctl 29 +#define __NR_ioprio_get 31 +#define __NR_ioprio_set 30 +#define __NR_kcmp 272 +#define __NR_kexec_file_load 294 +#define __NR_kexec_load 104 +#define __NR_keyctl 219 +#define __NR_kill 129 +#define __NR_lgetxattr 9 +#define __NR_linkat 37 +#define __NR_listen 201 +#define __NR_listxattr 11 +#define __NR_llistxattr 12 +#define __NR_llseek 62 +#define __NR_lookup_dcookie 18 +#define __NR_lremovexattr 15 +#define __NR_lsetxattr 6 +#define __NR_madvise 233 +#define __NR_mbind 235 +#define __NR_membarrier 283 +#define __NR_memfd_create 279 +#define __NR_migrate_pages 238 +#define __NR_mincore 232 +#define __NR_mkdirat 34 +#define __NR_mknodat 33 +#define __NR_mlock 228 +#define __NR_mlock2 284 +#define __NR_mlockall 230 +#define __NR_mmap2 222 +#define __NR_mount 40 +#define __NR_move_mount 429 +#define __NR_move_pages 239 +#define __NR_mprotect 226 +#define __NR_mq_getsetattr 185 +#define __NR_mq_notify 184 +#define __NR_mq_open 180 +#define __NR_mq_timedreceive_time64 419 +#define __NR_mq_timedsend_time64 418 +#define __NR_mq_unlink 181 +#define __NR_mremap 216 +#define __NR_msgctl 187 +#define __NR_msgget 186 +#define __NR_msgrcv 188 +#define __NR_msgsnd 189 +#define __NR_msync 227 +#define __NR_munlock 229 +#define __NR_munlockall 231 +#define __NR_munmap 215 +#define __NR_name_to_handle_at 264 +#define __NR_nfsservctl 42 +#define __NR_open_by_handle_at 265 +#define __NR_open_tree 428 +#define __NR_openat 56 +#define __NR_openat2 437 +#define __NR_perf_event_open 241 +#define __NR_personality 92 +#define __NR_pidfd_getfd 438 +#define __NR_pidfd_open 434 +#define __NR_pidfd_send_signal 424 +#define __NR_pipe2 59 +#define __NR_pivot_root 41 +#define __NR_pkey_alloc 289 +#define __NR_pkey_free 290 +#define __NR_pkey_mprotect 288 +#define __NR_ppoll_time64 414 +#define __NR_prctl 167 +#define __NR_pread64 67 +#define __NR_preadv 69 +#define __NR_preadv2 286 +#define __NR_prlimit64 261 +#define __NR_process_vm_readv 270 +#define __NR_process_vm_writev 271 +#define __NR_pselect6_time64 413 +#define __NR_ptrace 117 +#define __NR_pwrite64 68 +#define __NR_pwritev 70 +#define __NR_pwritev2 287 +#define __NR_quotactl 60 +#define __NR_read 63 +#define __NR_readahead 213 +#define __NR_readlinkat 78 +#define __NR_readv 65 +#define __NR_reboot 142 +#define __NR_recvfrom 207 +#define __NR_recvmmsg_time64 417 +#define __NR_recvmsg 212 +#define __NR_remap_file_pages 234 +#define __NR_removexattr 14 +#define __NR_renameat2 276 +#define __NR_request_key 218 +#define __NR_restart_syscall 128 +#define __NR_riscv_flush_icache 259 +#define __NR_rseq 293 +#define __NR_rt_sigaction 134 +#define __NR_rt_sigpending 136 +#define __NR_rt_sigprocmask 135 +#define __NR_rt_sigqueueinfo 138 +#define __NR_rt_sigreturn 139 +#define __NR_rt_sigsuspend 133 +#define __NR_rt_sigtimedwait_time64 421 +#define __NR_rt_tgsigqueueinfo 240 +#define __NR_sched_get_priority_max 125 +#define __NR_sched_get_priority_min 126 +#define __NR_sched_getaffinity 123 +#define __NR_sched_getattr 275 +#define __NR_sched_getparam 121 +#define __NR_sched_getscheduler 120 +#define __NR_sched_rr_get_interval_time64 423 +#define __NR_sched_setaffinity 122 +#define __NR_sched_setattr 274 +#define __NR_sched_setparam 118 +#define __NR_sched_setscheduler 119 +#define __NR_sched_yield 124 +#define __NR_seccomp 277 +#define __NR_semctl 191 +#define __NR_semget 190 +#define __NR_semop 193 +#define __NR_semtimedop_time64 420 +#define __NR_sendfile64 71 +#define __NR_sendmmsg 269 +#define __NR_sendmsg 211 +#define __NR_sendto 206 +#define __NR_set_mempolicy 237 +#define __NR_set_robust_list 99 +#define __NR_set_tid_address 96 +#define __NR_setdomainname 162 +#define __NR_setfsgid 152 +#define __NR_setfsuid 151 +#define __NR_setgid 144 +#define __NR_setgroups 159 +#define __NR_sethostname 161 +#define __NR_setitimer 103 +#define __NR_setns 268 +#define __NR_setpgid 154 +#define __NR_setpriority 140 +#define __NR_setregid 143 +#define __NR_setresgid 149 +#define __NR_setresuid 147 +#define __NR_setreuid 145 +#define __NR_setsid 157 +#define __NR_setsockopt 208 +#define __NR_setuid 146 +#define __NR_setxattr 5 +#define __NR_shmat 196 +#define __NR_shmctl 195 +#define __NR_shmdt 197 +#define __NR_shmget 194 +#define __NR_shutdown 210 +#define __NR_sigaltstack 132 +#define __NR_signalfd4 74 +#define __NR_socket 198 +#define __NR_socketpair 199 +#define __NR_splice 76 +#define __NR_statfs64 43 +#define __NR_statx 291 +#define __NR_swapoff 225 +#define __NR_swapon 224 +#define __NR_symlinkat 36 +#define __NR_sync 81 +#define __NR_sync_file_range 84 +#define __NR_syncfs 267 +#define __NR_sysinfo 179 +#define __NR_syslog 116 +#define __NR_tee 77 +#define __NR_tgkill 131 +#define __NR_timer_create 107 +#define __NR_timer_delete 111 +#define __NR_timer_getoverrun 109 +#define __NR_timer_gettime64 408 +#define __NR_timer_settime64 409 +#define __NR_timerfd_create 85 +#define __NR_timerfd_gettime64 410 +#define __NR_timerfd_settime64 411 +#define __NR_times 153 +#define __NR_tkill 130 +#define __NR_truncate64 45 +#define __NR_umask 166 +#define __NR_umount2 39 +#define __NR_uname 160 +#define __NR_unlinkat 35 +#define __NR_unshare 97 +#define __NR_userfaultfd 282 +#define __NR_utimensat_time64 412 +#define __NR_vhangup 58 +#define __NR_vmsplice 75 +#define __NR_waitid 95 +#define __NR_write 64 +#define __NR_writev 66 From patchwork Thu Apr 2 16:29:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38714 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id D416D388B800 for ; Thu, 2 Apr 2020 16:37:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D416D388B800 IronPort-SDR: 2oOqmpGifeIQijBgjyRjxJrbFD/EiWJrzX60COHvMcfIFukUd7jB2fDhaqN5esjTaY1Vjsfm1j I1p1eivb38yNfqRXHQ4mCul/RSnhDmmmFofemaKlERA01MREJy0bJlhKQTzpF49f3saf716BNv lqk52E1Dx0CURETDNyt2uxrJYNd9rAnab2BdCF7sSSyRqFB+buVWz1B38p1jMPtSLY9Poh0mc6 gMVDlK6JMA5Pd532Q/sv7pubsr9H+Y640eOu6J9iN2oeURBZUodSYwiXGNeZubNP6jxkrDaGKB qQM= X-IronPort-AV: E=Sophos;i="5.72,336,1580745600"; d="scan'208";a="134426333" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Apr 2020 00:37:27 +0800 IronPort-SDR: 14KuLqxjrkceAmnmmFUGnaY5LWk+HHak5Ho73mKyQDV2lZaId48SAwZ3PSXjO0WgjosP/7N0N1 yc+gJPQf8h1iCvuCio4aYYvskqKjS/wmmAS6mR++0/jiVTQEwK1WAsZguV3XY2fxcy9S+q41+q qgkhKy0uLWkxzVROHUrhj8TefSq12jw1DcVleBNzpWTOuTCfF9jygSKvF6hJUTRiPT+QxqFz1M laD0E1sYbjFZ15Erd3vEhMnMIdTwWucyV0rg36GBZuJCuU5m3tRrAk5G/E+bYp9o3Boj592nrd otiWXiLq5CIeeBtydqJNe85+ Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:28:18 -0700 IronPort-SDR: mL7R6u6uB1EKORpD3n2mYDYir0yP62ho1Qq+P2F0fhenABExeuKQa/f2J+oblOb8gAjnZFHO6I CeTFaXYeJ6HvzTXiamkUUkZSzu6fq5Uq6irmZ/3OrZBKIxMwoGDH/ZKQWdjcSX9rh20PqXTYxB ctAi2S0LFK+ycDMwDnrov8TZGBWTHZfpZN3K2zuydjiYw77y8ki9NrwbCGZAzlks557EzeQ5xK 7Vdmtei/Td471g3eWvO3iC+EPyZAWG4ZJdmqGqvhidKqLjpzyec+X/EPyX5QeHOoFpjPdcIyun ZJY= WDCIronportException: Internal Received: from phd004806.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.43]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Apr 2020 09:37:26 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH 08/18] RISC-V: nptl: update default pthread-offsets.h Date: Thu, 2 Apr 2020 09:29:38 -0700 Message-Id: <20200402162939.358617-9-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200402162939.358617-1-alistair.francis@wdc.com> References: <20200402162939.358617-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-26.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 16:37:35 -0000 Update the RISC-V pthread-offsets.h values to support RV32. --- sysdeps/riscv/nptl/pthread-offsets.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sysdeps/riscv/nptl/pthread-offsets.h b/sysdeps/riscv/nptl/pthread-offsets.h index 31f0587bec..a85c752a1f 100644 --- a/sysdeps/riscv/nptl/pthread-offsets.h +++ b/sysdeps/riscv/nptl/pthread-offsets.h @@ -1,3 +1,12 @@ -#define __PTHREAD_MUTEX_KIND_OFFSET 16 +#if __WORDSIZE == 64 +# define __PTHREAD_MUTEX_KIND_OFFSET 16 +#else +# define __PTHREAD_MUTEX_KIND_OFFSET 12 +#endif -#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 + +#if __WORDSIZE == 64 +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 +#else +# define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 +#endif From patchwork Thu Apr 2 16:29:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 38716 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by sourceware.org (Postfix) with ESMTPS id 73F98388B803 for ; Thu, 2 Apr 2020 16:37:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 73F98388B803 IronPort-SDR: hcnVsOno2GLwVlNXUNbOSQdQbXQRfaTcwhk0deYMHPjuXTZaq+9Ou+61k8yuxigCU5zD24P5JQ 6AecPIcLsxKOVpu60zcGnHMnKSYcNf4Urpk4In7rFMooTPzRC4UUD110u1xlipSob8W4vPoC6w eq0ZZ35VVg7keoPldN5p2dP05Ey7Po/7B68pMPVF426X2tlicE/dg1B9s6xg/M+yuvvrKRcFf9 eoFtRJqGGwWEJ64kqgOqjgSBjpLiu5AmoDgCOkIol8M0j9ucFjmrEneBXlFvgp3wZoRV5enrli EQk= X-IronPort-AV: E=Sophos;i="5.72,336,1580745600"; d="scan'208";a="134426334" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Apr 2020 00:37:27 +0800 IronPort-SDR: WgXCsEQX7avrdYmpRxTkKOagMdz3tJBxy88ccWE/54WGzS8VI1Sydf1RUy34rFvdzJSYs53ydm hp1Dam4C3jB3o9yKOWsB/ybmJcOY6PS3mFE/hnmDPFpjKkSZsxkRIOWCDMo5ObFhX0HVbM6tgO JAx44Rel9HNsexFw4n2tPmlw0WtMm4iwzAVE2R0HPuZF7V4YubmEWLTIU+H7QdJpYndvOpFTno zTnsj4e4B75VEEVt4Qsay0s8pVFPerDk0F8qs9NXqkwor7KK59qx6uUQScDNmeBfwgE/9+EE5A pwei9W0Td75xMUaWclV+Wzxg Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 09:28:18 -0700 IronPort-SDR: w09O2UWD3iSf2zMNyza2ctU/0WcN1AUiqPdsEwvNk1txBGke30bpMj+on30uXPNFOMDg9ftm+D 3fSRuZB6VuNM2kTAdN3iEL6qfarU6VCO9BRN4sP2/d9oZ4Hz+WeJzENam3c3PJyLswjKKa8VX4 y9cwVDV3qIabAx5er2Na0uLq4qcrHkFPD95/JUUbCsa/nE2Eb7JSwpGdP1yu3uPIFGdLwP1/j/ XTd10yhDRD3EH39V8N3oIdmQ78WnnFJ2SpCIxK3WnfUBwjz2+jyBQf/CaAneZ1pVpO/Ts48I4H qpw= WDCIronportException: Internal Received: from phd004806.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.55.43]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Apr 2020 09:37:27 -0700 From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Zong Li Subject: [PATCH 09/18] RISC-V: The ABI implementation for 32-bit Date: Thu, 2 Apr 2020 09:29:39 -0700 Message-Id: <20200402162939.358617-10-alistair.francis@wdc.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200402162939.358617-1-alistair.francis@wdc.com> References: <20200402162939.358617-1-alistair.francis@wdc.com> MIME-Version: 1.0 X-Spam-Status: No, score=-26.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2020 16:37:36 -0000 From: Zong Li This patch adds the ABI implementation about 32 bit version. It contains the Linux-specific and RISC-V architecture code, I've collected here. --- sysdeps/riscv/bits/wordsize.h | 4 +- sysdeps/riscv/nptl/bits/pthreadtypes-arch.h | 10 +++- sysdeps/riscv/nptl/bits/struct_rwlock.h | 27 +++++++++- sysdeps/riscv/sfp-machine.h | 27 +++++++++- sysdeps/riscv/sys/asm.h | 5 +- .../unix/sysv/linux/riscv/jmp_buf-macros.h | 53 +++++++++++++++++++ 6 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/riscv/jmp_buf-macros.h diff --git a/sysdeps/riscv/bits/wordsize.h b/sysdeps/riscv/bits/wordsize.h index faccc71828..ee430d9036 100644 --- a/sysdeps/riscv/bits/wordsize.h +++ b/sysdeps/riscv/bits/wordsize.h @@ -25,5 +25,7 @@ #if __riscv_xlen == 64 # define __WORDSIZE_TIME64_COMPAT32 1 #else -# error "rv32i-based targets are not supported" +# define __WORDSIZE_TIME64_COMPAT32 0 +# define __WORDSIZE32_SIZE_ULONG 0 +# define __WORDSIZE32_PTRDIFF_LONG 0 #endif diff --git a/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h b/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h index c3c72d6c10..363034c38a 100644 --- a/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h +++ b/sysdeps/riscv/nptl/bits/pthreadtypes-arch.h @@ -32,7 +32,15 @@ # define __SIZEOF_PTHREAD_BARRIER_T 32 # define __SIZEOF_PTHREAD_BARRIERATTR_T 4 #else -# error "rv32i-based systems are not supported" +# define __SIZEOF_PTHREAD_ATTR_T 32 +# define __SIZEOF_PTHREAD_MUTEX_T 32 +# define __SIZEOF_PTHREAD_MUTEXATTR_T 4 +# define __SIZEOF_PTHREAD_COND_T 48 +# define __SIZEOF_PTHREAD_CONDATTR_T 4 +# define __SIZEOF_PTHREAD_RWLOCK_T 48 +# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8 +# define __SIZEOF_PTHREAD_BARRIER_T 20 +# define __SIZEOF_PTHREAD_BARRIERATTR_T 4 #endif #define __LOCK_ALIGNMENT diff --git a/sysdeps/riscv/nptl/bits/struct_rwlock.h b/sysdeps/riscv/nptl/bits/struct_rwlock.h index acfaa75e1b..b478da0132 100644 --- a/sysdeps/riscv/nptl/bits/struct_rwlock.h +++ b/sysdeps/riscv/nptl/bits/struct_rwlock.h @@ -32,14 +32,39 @@ struct __pthread_rwlock_arch_t unsigned int __writers_futex; unsigned int __pad3; unsigned int __pad4; +#if __riscv_xlen == 64 int __cur_writer; int __shared; unsigned long int __pad1; unsigned long int __pad2; unsigned int __flags; +#else +# if __BYTE_ORDER == __BIG_ENDIAN + unsigned char __pad1; + unsigned char __pad2; + unsigned char __shared; + unsigned char __flags; +# else + unsigned char __flags; + unsigned char __shared; + unsigned char __pad1; + unsigned char __pad2; +# endif + int __cur_writer; +#endif }; -#define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ +#if __riscv_xlen == 64 +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags +#else +# if __BYTE_ORDER == __BIG_ENDIAN +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0 +# else +# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ + 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0 +# endif +#endif #endif diff --git a/sysdeps/riscv/sfp-machine.h b/sysdeps/riscv/sfp-machine.h index 08a84fd701..aef8c61a67 100644 --- a/sysdeps/riscv/sfp-machine.h +++ b/sysdeps/riscv/sfp-machine.h @@ -22,7 +22,32 @@ #if __riscv_xlen == 32 -# error "rv32i-based targets are not supported" +# define _FP_W_TYPE_SIZE 32 +# define _FP_W_TYPE unsigned long +# define _FP_WS_TYPE signed long +# define _FP_I_TYPE long + +# define _FP_MUL_MEAT_S(R, X, Y) \ + _FP_MUL_MEAT_1_wide (_FP_WFRACBITS_S, R, X, Y, umul_ppmm) +# define _FP_MUL_MEAT_D(R, X, Y) \ + _FP_MUL_MEAT_2_wide (_FP_WFRACBITS_D, R, X, Y, umul_ppmm) +# define _FP_MUL_MEAT_Q(R, X, Y) \ + _FP_MUL_MEAT_4_wide (_FP_WFRACBITS_Q, R, X, Y, umul_ppmm) + +# define _FP_MUL_MEAT_DW_S(R, X, Y) \ + _FP_MUL_MEAT_DW_1_wide (_FP_WFRACBITS_S, R, X, Y, umul_ppmm) +# define _FP_MUL_MEAT_DW_D(R, X, Y) \ + _FP_MUL_MEAT_DW_2_wide (_FP_WFRACBITS_D, R, X, Y, umul_ppmm) +# define _FP_MUL_MEAT_DW_Q(R, X, Y) \ + _FP_MUL_MEAT_DW_4_wide (_FP_WFRACBITS_Q, R, X, Y, umul_ppmm) + +# define _FP_DIV_MEAT_S(R, X, Y) _FP_DIV_MEAT_1_udiv_norm (S, R, X, Y) +# define _FP_DIV_MEAT_D(R, X, Y) _FP_DIV_MEAT_2_udiv (D, R, X, Y) +# define _FP_DIV_MEAT_Q(R, X, Y) _FP_DIV_MEAT_4_udiv (Q, R, X, Y) + +# define _FP_NANFRAC_S _FP_QNANBIT_S +# define _FP_NANFRAC_D _FP_QNANBIT_D, 0 +# define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0, 0, 0 #else diff --git a/sysdeps/riscv/sys/asm.h b/sysdeps/riscv/sys/asm.h index bd2de17e17..e314133ce4 100644 --- a/sysdeps/riscv/sys/asm.h +++ b/sysdeps/riscv/sys/asm.h @@ -26,7 +26,10 @@ # define REG_S sd # define REG_L ld #elif __riscv_xlen == 32 -# error "rv32i-based targets are not supported" +# define PTRLOG 2 +# define SZREG 4 +# define REG_S sw +# define REG_L lw #else # error __riscv_xlen must equal 32 or 64 #endif diff --git a/sysdeps/unix/sysv/linux/riscv/jmp_buf-macros.h b/sysdeps/unix/sysv/linux/riscv/jmp_buf-macros.h new file mode 100644 index 0000000000..7e48f24345 --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/jmp_buf-macros.h @@ -0,0 +1,53 @@ +/* jump buffer constants for RISC-V + Copyright (C) 2017-2020 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 + . */ + +/* Produced by this program: + + #include + #include + #include + #include + + int main (int argc, char **argv) + { + printf ("#define JMP_BUF_SIZE %d\n", sizeof (jmp_buf)); + printf ("#define JMP_BUF_ALIGN %d\n", __alignof__ (jmp_buf)); + printf ("#define SIGJMP_BUF_SIZE %d\n", sizeof (sigjmp_buf)); + printf ("#define SIGJMP_BUF_ALIGN %d\n", __alignof__ (sigjmp_buf)); + printf ("#define MASK_WAS_SAVED_OFFSET %d\n", offsetof (struct __jmp_buf_tag, __mask_was_saved)); + printf ("#define SAVED_MASK_OFFSET %d\n", offsetof (struct __jmp_buf_tag, __saved_mask)); + } */ + +#if defined __riscv_float_abi_soft +# define JMP_BUF_SIZE 188 +# define JMP_BUF_ALIGN 4 +# define SIGJMP_BUF_SIZE 188 +# define SIGJMP_BUF_ALIGN 4 +# define MASK_WAS_SAVED_OFFSET 56 +# define SAVED_MASK_OFFSET 60 +#elif defined __riscv_float_abi_double +# define JMP_BUF_SIZE 288 +# define JMP_BUF_ALIGN 8 +# define SIGJMP_BUF_SIZE 288 +# define SIGJMP_BUF_ALIGN 8 +# define MASK_WAS_SAVED_OFFSET 152 +# define SAVED_MASK_OFFSET 156 +#else +# error "Unknown RISC-V floating-point ABI" +#endif