From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.2 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by inbox.vuxu.org (OpenSMTPD) with SMTP id 21d0fb7e for ; Tue, 4 Feb 2020 14:31:54 +0000 (UTC) Received: (qmail 28472 invoked by uid 550); 4 Feb 2020 14:31:52 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 28440 invoked from network); 4 Feb 2020 14:31:51 -0000 Date: Tue, 4 Feb 2020 09:31:36 -0500 From: Rich Felker To: Mark Corbin Cc: musl@lists.openwall.com Message-ID: <20200204143136.GV1663@brightrain.aerifal.cx> References: <1815351.tyXQvQ9DpD@laptop> <5347084.5DbCtkH2XI@laptop> <20200203152427.GQ1663@brightrain.aerifal.cx> <2463923.aTGIt9PGv2@laptop> <20200204142631.GU1663@brightrain.aerifal.cx> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="cvVnyQ+4j833TQvp" Content-Disposition: inline In-Reply-To: <20200204142631.GU1663@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: Rich Felker Subject: [musl] [PATCH] move riscv64 register index constants to signal.h --cvVnyQ+4j833TQvp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Feb 04, 2020 at 09:26:31AM -0500, Rich Felker wrote: > > > > I guess that it would probably be best to change the libsigsegv code to > > > > use a value of '2' instead of the REG_SP definition. I'll look at > > > > submitting a patch to the project. > > > > > > I think using a symbolic name is both more informative and more > > > portable (since the layout of the saved registers is an OS choice, > > > nothing universal to the architecture). The question is just where the > > > macro should be obtained from. As long as glibc (and any other > > > platforms that might be relevant?) has a sys/reg.h, it wouldn't hurt > > > to just add the include and continue using the macro, regardless of > > > whether musl moves it later. > > > > Glibc and uClibc don't have a sys/reg.h - is there a way that it could be > > included conditionally for musl only? > > If you want a configure test to detect it the yes; otherwise no. But > this suggests the way we did it is wrong. We should not be making this > kind of mess. I should probably just move the definitions... Patch attached. Any objections? Rich --cvVnyQ+4j833TQvp Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-move-riscv64-register-index-constants-to-signal.h.patch" >From 329e79299daaa994b8e75941331a1093051ea5d9 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 4 Feb 2020 09:29:13 -0500 Subject: [PATCH] move riscv64 register index constants to signal.h under _GNU_SOURCE for namespace cleanliness, analogous to other archs. the original placement in sys/reg.h seems not to have been motivated; such a header isn't even present on other implementations. --- arch/riscv64/bits/reg.h | 6 ------ arch/riscv64/bits/signal.h | 9 +++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/riscv64/bits/reg.h b/arch/riscv64/bits/reg.h index c800788c..2633f39d 100644 --- a/arch/riscv64/bits/reg.h +++ b/arch/riscv64/bits/reg.h @@ -1,8 +1,2 @@ #undef __WORDSIZE #define __WORDSIZE 64 -#define REG_PC 0 -#define REG_RA 1 -#define REG_SP 2 -#define REG_TP 4 -#define REG_S0 8 -#define REG_A0 10 diff --git a/arch/riscv64/bits/signal.h b/arch/riscv64/bits/signal.h index 2ff4be30..b006334f 100644 --- a/arch/riscv64/bits/signal.h +++ b/arch/riscv64/bits/signal.h @@ -35,6 +35,15 @@ typedef struct mcontext_t { union __riscv_mc_fp_state __fpregs; } mcontext_t; +#if defined(_GNU_SOURCE) +#define REG_PC 0 +#define REG_RA 1 +#define REG_SP 2 +#define REG_TP 4 +#define REG_S0 8 +#define REG_A0 10 +#endif + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) typedef unsigned long greg_t; typedef unsigned long gregset_t[32]; -- 2.21.0 --cvVnyQ+4j833TQvp--