From patchwork Sun Jul 12 15:47:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 40050 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E33B8385703D; Sun, 12 Jul 2020 15:57:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E33B8385703D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594569437; bh=9+Lx/gDmsdEg1b8ay+NnZtkDowI5wP/H1Re0pm/Ut0Y=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=hIcDY8Sj5iE0SzcS5XdieLRFMfscVDJa4RW69Uk2tBsvmKCodYWF85RVzzDc3ji0l ivYwLZLfyxd4ag9gnXG7ZQyhtcKrmoOdS8Qmi+psBywyCy7bsoi2EDRI0ZePoskwLK plWw54xbDcylU5DfW0NyyRD00ywDHAGBjXm8aclw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by sourceware.org (Postfix) with ESMTPS id A30AE3857027 for ; Sun, 12 Jul 2020 15:57:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A30AE3857027 IronPort-SDR: RThXdkq21JZsa2HrwhTW2kHaBwdg+QxSpGd1rIctey+SXhc1EUeBSJ9XcWnlMcUdfwpBNxwJUZ aNhlZXbHp+khEQxQzX2ARGUEmdaT86fYTXvAX9Ezs+BBZHEvOrRLdsWWI2wSEyKwKRGF4yJ3Py nNCg0UIFyU7rxFxwfAyoyxEixU/G7EMLQqLxloggOfOw1KHxKEXwX2NCpgdQ7dfXZO/e+DGWjH K2EsOrE2UVXXD5hkNaOeg09HLyASU9CrSilQSY9fiG/YZq3Y1ZLdtF12wi03egYxl0sTfxKw0R 8Vg= X-IronPort-AV: E=Sophos;i="5.75,344,1589212800"; d="scan'208";a="146561179" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 12 Jul 2020 23:57:00 +0800 IronPort-SDR: +6tt7gGIHL4DYk5Bi/inuZTAI0rdZc364waNgH0dZIpMVBTw5Xle08ICQRi/mZ51KU1YHp1Q8j 2O7VtHkZhbph1I4lPDZOaKv/W9dwlngDQ= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jul 2020 08:45:30 -0700 IronPort-SDR: OLCYHmnJstngM9XiEWI0K8pXn5w0sK3Ci3XUnD+uIyZmVCmQ1XW1OLWOjgAsyQyVLoa7qZrTIJ zQt9+vr1NeXw== WDCIronportException: Internal Received: from usa002626.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.57.178]) by uls-op-cesaip02.wdc.com with ESMTP; 12 Jul 2020 08:56:59 -0700 To: libc-alpha@sourceware.org Subject: [PATCH v3 03/19] RISC-V: Use 64-bit-time syscall numbers with the 32-bit port Date: Sun, 12 Jul 2020 08:47:28 -0700 Message-Id: <8c6518f04fc70bebac9b00a171c691feca0d2628.1594568655.git.alistair.francis@wdc.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-14.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_PASS, 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-Patchwork-Original-From: Alistair Francis via Libc-alpha From: Alistair Francis Reply-To: Alistair Francis Cc: alistair.francis@wdc.com Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" This patches adds any required syscall suppression for 32-bit off_t/time_t to fixup-asm-unistd.h so arch-syscall.h will have only the required definitions. sysdep.h redefines only the syscall where the generic implementation still does not have actual 64-bit time_t support: /* "workarounds" for generic code needing to handle 64-bit time_t. */ /* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */ #define __NR_clock_getres __NR_clock_getres_time64 /* Fix sysdeps/nptl/lowlevellock-futex.h. */ #define __NR_futex __NR_futex_time64 [...] This patch also adds a comment that it is a workaround to handle 64-bit time_t and on each #define comment for which implementation it intends to. --- .../unix/sysv/linux/riscv/fixup-asm-unistd.h | 45 +++++++++++++++++++ sysdeps/unix/sysv/linux/riscv/sysdep.h | 27 +++++++++++ 2 files changed, 72 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/riscv/fixup-asm-unistd.h diff --git a/sysdeps/unix/sysv/linux/riscv/fixup-asm-unistd.h b/sysdeps/unix/sysv/linux/riscv/fixup-asm-unistd.h new file mode 100644 index 0000000000..bc8b10e283 --- /dev/null +++ b/sysdeps/unix/sysv/linux/riscv/fixup-asm-unistd.h @@ -0,0 +1,45 @@ +/* Regularize definitions. RISC-V version. + Copyright (C) 2020 Free Software Foundation, Inc. + + 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 + . */ + +/* Adjustments to RISC-V asm-generic syscall for 64-bit time_t support. */ + +/* fstat64 and fstatat64 need to be replaced with statx. */ + +#undef __NR_fstat64 +#undef __NR_fstatat64 + +/* Replace all other 32-bit time syscalls with 64-bit variants. */ + +# undef __NR_clock_adjtime +# undef __NR_clock_getres +# undef __NR_clock_gettime +# undef __NR_clock_nanosleep +# undef __NR_clock_settime +# undef __NR_futex +# undef __NR_mq_timedreceive +# undef __NR_mq_timedsend +# undef __NR_ppoll +# undef __NR_pselect6 +# undef __NR_recvmmsg +# undef __NR_rt_sigtimedwait +# undef __NR_sched_rr_get_interval +# undef __NR_semtimedop +# undef __NR_timer_gettime +# undef __NR_timer_settime +# undef __NR_timerfd_gettime +# undef __NR_timerfd_settime +# undef __NR_utimensat diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h index 429686cebe..62a9551f50 100644 --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h @@ -22,6 +22,33 @@ #include #include +#if __WORDSIZE == 32 + + +/* "workarounds" for generic code needing to handle 64-bit time_t. */ + +/* Fix sysdeps/unix/sysv/linux/clock_getcpuclockid.c. */ +#define __NR_clock_getres __NR_clock_getres_time64 +/* Fix sysdeps/nptl/lowlevellock-futex.h. */ +#define __NR_futex __NR_futex_time64 +/* Fix sysdeps/unix/sysv/linux/pause.c. */ +#define __NR_ppoll __NR_ppoll_time64 +/* Fix sysdeps/unix/sysv/linux/select.c. */ +#define __NR_pselect6 __NR_pselect6_time64 +/* Fix sysdeps/unix/sysv/linux/recvmmsg.c. */ +#define __NR_recvmmsg __NR_recvmmsg_time64 +/* Fix sysdeps/unix/sysv/linux/sigtimedwait.c. */ +#define __NR_rt_sigtimedwait __NR_rt_sigtimedwait_time64 +/* Fix sysdeps/unix/sysv/linux/semtimedop.c. */ +#define __NR_semtimedop __NR_semtimedop_time64 +/* Hack sysdeps/unix/sysv/linux/generic/utimes.c. */ +#define __NR_utimensat __NR_utimensat_time64 + +#endif /* __WORDSIZE == 32 */ + +#undef SYS_ify +#define SYS_ify(syscall_name) __NR_##syscall_name + #ifdef __ASSEMBLER__ # include