From: Rich Felker <dalias@libc.org>
To: Jesse Taube <mr.bossman075@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: [musl] [PATCH] arch/riscv*/atomic_arch.h: Check if atomic is supported
Date: Mon, 2 Sep 2024 17:02:35 -0400 [thread overview]
Message-ID: <20240902210235.GT10433@brightrain.aerifal.cx> (raw)
In-Reply-To: <20240902195614.3169239-1-Mr.Bossman075@gmail.com>
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 <Mr.Bossman075@gmail.com>
> ---
> 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
prev parent reply other threads:[~2024-09-02 21:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-02 19:56 Jesse Taube
2024-09-02 21:02 ` Rich Felker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240902210235.GT10433@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=mr.bossman075@gmail.com \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).