From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id EB7F12D848 for ; Mon, 2 Sep 2024 23:02:49 +0200 (CEST) Received: (qmail 3393 invoked by uid 550); 2 Sep 2024 21:02:44 -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 3355 invoked from network); 2 Sep 2024 21:02:43 -0000 Date: Mon, 2 Sep 2024 17:02:35 -0400 From: Rich Felker To: Jesse Taube Cc: musl@lists.openwall.com Message-ID: <20240902210235.GT10433@brightrain.aerifal.cx> References: <20240902195614.3169239-1-Mr.Bossman075@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240902195614.3169239-1-Mr.Bossman075@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [musl] [PATCH] arch/riscv*/atomic_arch.h: Check if atomic is supported On Mon, Sep 02, 2024 at 03:56:14PM -0400, Jesse Taube wrote: > Define a_cas and a_cas_p only if atomic instructions are supported. > > Signed-off-by: Jesse Taube > --- > arch/riscv32/atomic_arch.h | 4 ++++ > arch/riscv64/atomic_arch.h | 4 ++++ > 2 files changed, 8 insertions(+) > > diff --git a/arch/riscv32/atomic_arch.h b/arch/riscv32/atomic_arch.h > index 4d418f63..331ce46e 100644 > --- a/arch/riscv32/atomic_arch.h > +++ b/arch/riscv32/atomic_arch.h > @@ -4,6 +4,8 @@ static inline void a_barrier() > __asm__ __volatile__ ("fence rw,rw" : : : "memory"); > } > > +#if defined(__riscv_a) || defined(__riscv_atomic) > + > #define a_cas a_cas > static inline int a_cas(volatile int *p, int t, int s) > { > @@ -19,3 +21,5 @@ static inline int a_cas(volatile int *p, int t, int s) > : "memory"); > return old; > } > + > +#endif > diff --git a/arch/riscv64/atomic_arch.h b/arch/riscv64/atomic_arch.h > index 0c382588..dac972d2 100644 > --- a/arch/riscv64/atomic_arch.h > +++ b/arch/riscv64/atomic_arch.h > @@ -4,6 +4,8 @@ static inline void a_barrier() > __asm__ __volatile__ ("fence rw,rw" : : : "memory"); > } > > +#if defined(__riscv_a) || defined(__riscv_atomic) > + > #define a_cas a_cas > static inline int a_cas(volatile int *p, int t, int s) > { > @@ -36,3 +38,5 @@ static inline void *a_cas_p(volatile void *p, void *t, void *s) > : "memory"); > return old; > } > + > +#endif > -- > 2.45.2 These are a hard dependency. You can't just omit them. The build will fail elsewhere without them, not to mention stuff blowing up at runtime. What is the actual problem you're trying to solve? Rich