package/uclibc: Fix build when RVA is disabled
PATCH 1/1 package/uclibc: Fix build when RVA is disabled
If the RVA option is disabled uclibc won't build with Shared libraries enabled or Threads enabled. Add guards against this.
When the RVA option is disabled, the build fails with the following errors:
With Threads enabled:
LD libuClibc-1.0.48.so
riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(err.os): in function `.L0 ':
err.c:(.text+0xa0): undefined reference to __atomic_compare_exchange_4' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(err.os): in function .L6':
err.c:(.text+0x138): undefined reference to __atomic_exchange_4' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(__cxa_finalize.os): in function .L3':
__cxa_finalize.c:(.text+0xac): undefined reference to __atomic_compare_exchange_8' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(fork.oS): in function .L23':
fork.c:(.text+0x130): undefined reference to __atomic_fetch_add_4' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(sem_timedwait.oS): in function .L5':
sem_timedwait.c:(.text+0xe0): undefined reference to `__atomic_fetch_add_8'
With Shared libraries enabled:
LD libuClibc-1.0.48.so
riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(__cxa_finalize.os): in function `.L3':
__cxa_finalize.c:(.text+0xa4): undefined reference to `__atomic_compare_exchange_8'
--- arch/Config.in | 2 +- package/uclibc/Config.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/Config.in +1 -1
@@ -431,7 +431,7 @@ choice config BR2_BINFMT_ELF bool "ELF" depends on BR2_USE_MMU - select BR2_BINFMT_SUPPORTS_SHARED + select BR2_BINFMT_SUPPORTS_SHARED if !BR2_riscv || BR2_RISCV_ISA_RVA help ELF (Executable and Linkable Format) is a format for libraries and executables used across different architectures and
package/uclibc/Config.in +2 -2
@@ -78,13 +78,13 @@ choice config BR2_PTHREADS_NATIVE bool "Native POSIX Threading (NPTL)" - depends on BR2_USE_MMU + depends on BR2_USE_MMU && (!BR2_riscv || BR2_RISCV_ISA_RVA) select BR2_TOOLCHAIN_HAS_THREADS select BR2_TOOLCHAIN_HAS_THREADS_NPTL config BR2_PTHREADS bool "linuxthreads" - depends on !BR2_aarch64 && !BR2_aarch64_be + depends on !BR2_aarch64 && !BR2_aarch64_be && (!BR2_riscv || BR2_RISCV_ISA_RVA) select BR2_TOOLCHAIN_HAS_THREADS config BR2_PTHREADS_NONE
Signature · 6 lines
2.45.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello,
+Waldemar in Cc, uclibc stuff :-)
Quoted 2 lines · On Mon, 2 Sep 2024 13:59:56 -0400 Jesse Taube <[email protected]> wrote:
If the RVA option is disabled uclibc won't build with Shared libraries enabled or Threads enabled. Add guards against this.
Meh, this looks weird to me, and I'd like some better understanding before adding "random" guards.
Quoted 33 lines
When the RVA option is disabled, the build fails with the following errors:
With Threads enabled:LD libuClibc-1.0.48.so
riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(err.os): in function `.L0 ':
err.c:(.text+0xa0): undefined reference to__atomic_compare_exchange_4' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(err.os): in function.L6':
err.c:(.text+0x138): undefined reference to__atomic_exchange_4' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(__cxa_finalize.os): in function.L3':
__cxa_finalize.c:(.text+0xac): undefined reference to__atomic_compare_exchange_8' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(fork.oS): in function.L23':
fork.c:(.text+0x130): undefined reference to__atomic_fetch_add_4' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(sem_timedwait.oS): in function.L5':
sem_timedwait.c:(.text+0xe0): undefined reference to `__atomic_fetch_add_8'With Shared libraries enabled:
LD libuClibc-1.0.48.so
riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(__cxa_finalize.os): in function `.L3':
__cxa_finalize.c:(.text+0xa4): undefined reference to `__atomic_compare_exchange_8'Signed-off-by Jesse Taube <[email protected]>--- arch/Config.in | 2 +- package/uclibc/Config.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)arch/Config.in +0
-0
arch/Config.in choice · line 434
Quoted 5 lines
arch/Config.in +1
-1@@ -431,7 +431,7 @@ choice config BR2_BINFMT_ELF bool "ELF" depends on BR2_USE_MMU - select BR2_BINFMT_SUPPORTS_SHARED + select BR2_BINFMT_SUPPORTS_SHARED if !BR2_riscv || BR2_RISCV_ISA_RVA
Why this? This is no covered in your commit log.
Quoted 11 lines
arch/Config.in +0
-0help ELF (Executable and Linkable Format) is a format for libraries and executables used across different architectures andpackage/uclibc/Config.in +0
-0@@ -78,13 +78,13 @@ choice config BR2_PTHREADS_NATIVE bool "Native POSIX Threading (NPTL)"
package/uclibc/Config.in choice · line 88
Quoted 10 lines
package/uclibc/Config.in +2
-2- depends on BR2_USE_MMU + depends on BR2_USE_MMU && (!BR2_riscv || BR2_RISCV_ISA_RVA) select BR2_TOOLCHAIN_HAS_THREADS select BR2_TOOLCHAIN_HAS_THREADS_NPTL config BR2_PTHREADS bool "linuxthreads" - depends on !BR2_aarch64 && !BR2_aarch64_be + depends on !BR2_aarch64 && !BR2_aarch64_be && (!BR2_riscv || BR2_RISCV_ISA_RVA) select BR2_TOOLCHAIN_HAS_THREADS
I would really like to hear back from Waldemar on this.
uClibc supports architectures that don't have atomic support (such as ARC750/ARC770), so it is somewhat surprising that it wouldn't support RISC-V without atomics. So let's try to understand the real problem and find the correct solution rather than papering over the problem in a very custom/architecture-specific way.
Thanks!
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Thomas,
Thomas Petazzoni wrote,
Quoted 78 lines
Hello,
+Waldemar in Cc, uclibc stuff :-)
Quoted 2 lines · On Mon, 2 Sep 2024 13:59:56 -0400 Jesse Taube <[email protected]> wrote:
If the RVA option is disabled uclibc won't build with Shared libraries enabled or Threads enabled. Add guards against this.
Meh, this looks weird to me, and I'd like some better understanding before adding "random" guards.
Quoted 33 lines
When the RVA option is disabled, the build fails with the following errors:
With Threads enabled:LD libuClibc-1.0.48.so
riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(err.os): in function `.L0 ':
err.c:(.text+0xa0): undefined reference to__atomic_compare_exchange_4' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(err.os): in function.L6':
err.c:(.text+0x138): undefined reference to__atomic_exchange_4' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(__cxa_finalize.os): in function.L3':
__cxa_finalize.c:(.text+0xac): undefined reference to__atomic_compare_exchange_8' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(fork.oS): in function.L23':
fork.c:(.text+0x130): undefined reference to__atomic_fetch_add_4' riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(sem_timedwait.oS): in function.L5':
sem_timedwait.c:(.text+0xe0): undefined reference to `__atomic_fetch_add_8'With Shared libraries enabled:
LD libuClibc-1.0.48.so
riscv64-buildroot-linux-uclibc/bin/ld: libc/libc_so.a(__cxa_finalize.os): in function `.L3':
__cxa_finalize.c:(.text+0xa4): undefined reference to `__atomic_compare_exchange_8'Signed-off-by Jesse Taube <[email protected]>--- arch/Config.in | 2 +- package/uclibc/Config.in | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)arch/Config.in +0
-0arch/Config.in choice · line 434
Quoted 5 lines
arch/Config.in +1
-1@@ -431,7 +431,7 @@ choice config BR2_BINFMT_ELF bool "ELF" depends on BR2_USE_MMU - select BR2_BINFMT_SUPPORTS_SHARED + select BR2_BINFMT_SUPPORTS_SHARED if !BR2_riscv || BR2_RISCV_ISA_RVAWhy this? This is no covered in your commit log.
Quoted 11 lines
arch/Config.in +0
-0help ELF (Executable and Linkable Format) is a format for libraries and executables used across different architectures andpackage/uclibc/Config.in +0
-0@@ -78,13 +78,13 @@ choice config BR2_PTHREADS_NATIVE bool "Native POSIX Threading (NPTL)"package/uclibc/Config.in choice · line 88
Quoted 10 lines
package/uclibc/Config.in +2
-2- depends on BR2_USE_MMU + depends on BR2_USE_MMU && (!BR2_riscv || BR2_RISCV_ISA_RVA) select BR2_TOOLCHAIN_HAS_THREADS select BR2_TOOLCHAIN_HAS_THREADS_NPTL config BR2_PTHREADS bool "linuxthreads" - depends on !BR2_aarch64 && !BR2_aarch64_be + depends on !BR2_aarch64 && !BR2_aarch64_be && (!BR2_riscv || BR2_RISCV_ISA_RVA) select BR2_TOOLCHAIN_HAS_THREADSI would really like to hear back from Waldemar on this.
Quoted 5 lines
uClibc supports architectures that don't have atomic support (such as ARC750/ARC770), so it is somewhat surprising that it wouldn't support RISC-V without atomics. So let's try to understand the real problem and find the correct solution rather than papering over the problem in a very custom/architecture-specific way.
It seems indeed that uClibc-ng depends on RV-A extension. Gcc emits the calls to some atomic functions when RV-A is disabled in the compiler. It is not uClibc-ng itself. We don't use atomic functions. I haven't found a way to disable this behaviour in GCC.
best regards
Waldemar
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot