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=-2.9 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 D9F652D014 for ; Mon, 2 Sep 2024 21:56:29 +0200 (CEST) Received: (qmail 15362 invoked by uid 550); 2 Sep 2024 19:56:24 -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 14295 invoked from network); 2 Sep 2024 19:56:24 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725306975; x=1725911775; darn=lists.openwall.com; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=H0dzLhixeysxgLB7aK+jybs4v0UcJywRJRkr+iEa+fk=; b=fHXadTftFMXft1jXoEKdU5bot6Cj0TLO1E7ZPeHXdHsChZgDW0gQZexlzOy+B//6G4 JlVhnG1qYr9cfnmzyVEOwkqaR+/erqNFzdfEO7CKedycqLKlS6mLYxUCorfD16YA3kFy M0YMuMQHo4I/1Ktad8alf4J3OzKhX8vudbgNqw7XHfFuq7HUlTwg5u8/jF6KMNQDYoND q5eJoSa2O1sDhtsrJF2lliLNVFJpGwDM0OrWrpgeV989NrOuRzCWZAjNZOfiMKX4Uuol ysHwvNXVk0SibY7Lb7T+g8uIsAyUdKEvZlPCMxagR7Tq0AWSTW/7yjBOS72vODeyUAKx hp+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725306975; x=1725911775; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=H0dzLhixeysxgLB7aK+jybs4v0UcJywRJRkr+iEa+fk=; b=PZhnB9FxB1YmQg2W5QzlQOybBnasiBTs6ru0EHMTzeEkkc1JmH5Ipq2goMTxhyViSG 2DA1l4yR3zvKyPBxmUUNYy1tO64T1ca0hgsFiwLvEyQiQZp7fpUWHFMpp+sxj96/tmpY p5Ke3x40fpC9GX2d+Imcdquwnv+yBIweG1wYdz1JMNyLc5Xg8wg2XPjIoCrnnluK37MW UJ0f+swjXsftYQQP7lnSlRtUYxrGfR7BTobcGkIwLiE/CmQK+KAQeBLCgufxP/BLyYHT 4+uRqCZ8cP2n4I6g2Rrm7A7eQiyP7DR3nbE6k7F32XrVQAP+Lzr3HWnGp/jejo+SFmqb 9Iyw== X-Gm-Message-State: AOJu0YwIZxdb0ipn8XnOeinpHB+PWTY7gPJY6OZF4QJmEtEQgsW4Hx1A kYdM+xB8R5zkHmiMRPnOdUtLeLbQTiSq+HTjZUrd2IlGP28fe4cOiJC2Gw== X-Google-Smtp-Source: AGHT+IG/0KgrKI83Yew+pzaYbnvnqKOeuvsfuENakt5S8DwvhStsMXR5dRnFpZ5ND5bERYAUg8MYTA== X-Received: by 2002:a05:6820:2216:b0:5d6:ae6:a852 with SMTP id 006d021491bc7-5dfacf28289mr14012880eaf.6.1725306975179; Mon, 02 Sep 2024 12:56:15 -0700 (PDT) From: Jesse Taube X-Google-Original-From: Jesse Taube To: musl@lists.openwall.com Cc: dalias@libc.org, Jesse Taube Date: Mon, 2 Sep 2024 15:56:14 -0400 Message-ID: <20240902195614.3169239-1-Mr.Bossman075@gmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH] arch/riscv*/atomic_arch.h: Check if atomic is supported 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