__NR_riscv_hwprobe is not exported in musl's hwprobe.h
this fails to build with newer kernels

Fixes
| :85:20: error: use of undeclared identifier '__NR_riscv_hwprobe'; did you 
mean 'riscv_hwprobe'?
|    85 |     return syscall(__NR_riscv_hwprobe, pairs, pair_count, cpu_count, 
cpus, flags);
|       |                    ^~~~~~~~~~~~~~~~~~

Signed-off-by: Khem Raj <raj.k...@gmail.com>
---
 ...001-Fix-builds-on-riscv64-using-musl.patch | 36 +++++++++++++++++++
 .../openssl/openssl_3.4.0.bb                  |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 
meta/recipes-connectivity/openssl/openssl/0001-Fix-builds-on-riscv64-using-musl.patch

diff --git 
a/meta/recipes-connectivity/openssl/openssl/0001-Fix-builds-on-riscv64-using-musl.patch
 
b/meta/recipes-connectivity/openssl/openssl/0001-Fix-builds-on-riscv64-using-musl.patch
new file mode 100644
index 00000000000..0ec8c937483
--- /dev/null
+++ 
b/meta/recipes-connectivity/openssl/openssl/0001-Fix-builds-on-riscv64-using-musl.patch
@@ -0,0 +1,36 @@
+From 9131291716073c4ea65a29575880a9d796c22ed6 Mon Sep 17 00:00:00 2001
+From: Matt Caswell <m...@openssl.org>
+Date: Wed, 23 Oct 2024 14:57:20 +0100
+Subject: [PATCH] Fix builds on riscv64 using musl
+
+Some environments using musl are reported to have the hwprobe.h include
+file but not have the __NR_riscv_hwprobe define.
+
+Fixes #25772
+
+Upstream-Status: Backport [https://github.com/openssl/openssl/pull/25787]
+Signed-off-by: Khem Raj <raj.k...@gmail.com>
+---
+ include/crypto/riscv_arch.h | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/include/crypto/riscv_arch.h b/include/crypto/riscv_arch.h
+index 4b3573f..8858427 100644
+--- a/include/crypto/riscv_arch.h
++++ b/include/crypto/riscv_arch.h
+@@ -15,7 +15,14 @@
+ 
+ # if defined(OPENSSL_SYS_LINUX) && !defined(FIPS_MODULE)
+ #  if __has_include(<asm/hwprobe.h>)
+-#   define OSSL_RISCV_HWPROBE
++#   include <sys/syscall.h>
++#   /*
++     * Some environments using musl are reported to have the hwprobe.h include
++     * file but not have the __NR_riscv_hwprobe define.
++     */
++#   ifdef __NR_riscv_hwprobe
++#    define OSSL_RISCV_HWPROBE
++#   endif
+ #  endif
+ # endif
+ 
diff --git a/meta/recipes-connectivity/openssl/openssl_3.4.0.bb 
b/meta/recipes-connectivity/openssl/openssl_3.4.0.bb
index 734e3c54ef0..b7f96db3941 100644
--- a/meta/recipes-connectivity/openssl/openssl_3.4.0.bb
+++ b/meta/recipes-connectivity/openssl/openssl_3.4.0.bb
@@ -12,6 +12,7 @@ SRC_URI = "http://www.openssl.org/source/openssl-${PV}.tar.gz 
\
            
file://0001-buildinfo-strip-sysroot-and-debug-prefix-map-from-co.patch \
            file://0001-Configure-do-not-tweak-mips-cflags.patch \
            file://0001-Added-handshake-history-reporting-when-test-fails.patch 
\
+           file://0001-Fix-builds-on-riscv64-using-musl.patch \
            "
 
 SRC_URI:append:class-nativesdk = " \
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#208326): 
https://lists.openembedded.org/g/openembedded-core/message/208326
Mute This Topic: https://lists.openembedded.org/mt/109927213/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to