diff mbox series

[meta-oe] liburing: Use libc on rv64/clang18

Message ID 20240524213140.1856788-1-raj.khem@gmail.com
State New
Headers show
Series [meta-oe] liburing: Use libc on rv64/clang18 | expand

Commit Message

Khem Raj May 24, 2024, 9:31 p.m. UTC
clang18 generates memset call which demands linking with libc

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta-oe/recipes-support/liburing/liburing_2.6.bb | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/liburing/liburing_2.6.bb b/meta-oe/recipes-support/liburing/liburing_2.6.bb
index b892ce4ac2..fc3fe1cac1 100644
--- a/meta-oe/recipes-support/liburing/liburing_2.6.bb
+++ b/meta-oe/recipes-support/liburing/liburing_2.6.bb
@@ -18,9 +18,14 @@  DEPENDS:append:libc-musl = " libucontext"
 XCFLAGS = "-pthread"
 XCFLAGS:append:libc-musl = " -lucontext"
 
+USELIBC = ""
+# clang-18 on RV64 emits memset for arch/riscv64/syscall.h provided __do_syscall4 macro
+# this does not happen for gcc or older clang, so link with libc since we need memset API
+# -fno-builtin-memset does not help
+USELIBC:riscv64:toolchain-clang = "--use-libc"
 EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}/include -DWITHOUT_XATTR' 'LDFLAGS=${LDFLAGS}' 'XCFLAGS=${XCFLAGS}' 'BUILDDIR=${S}'"
 do_configure() {
-    ${S}/configure --prefix=${prefix} --libdir=${libdir} --libdevdir=${libdir} --mandir=${mandir} --datadir=${datadir} --includedir=${includedir}
+    ${S}/configure --prefix=${prefix} --libdir=${libdir} --libdevdir=${libdir} --mandir=${mandir} --datadir=${datadir} --includedir=${includedir} ${USELIBC}
 }
 do_install () {
     oe_runmake install DESTDIR=${D}