Just polling to see if anyone is using aarch64 in uclibc-ng. I created a
toolchain from buildroot for some new hardware I got but noticed a lot
of segfaulting with c++ applications. Thinking it was possibly a
libstdc++ issue I opened a bug report.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106581
But it seems to concluded that uclibc-ng tls support for aarch64 isn't
quite there. Some of the segfaulting is fixed if libstdc++ is static
linked, but doesn't quite fix all the issues.
https://lists.buildroot.org/pipermail/buildroot/2022-August/648961.html
Also got this response on the buildroot mailing list.
thank,
Lanec
Hello,
While looking at some uClibc code, I stumbled across the following
snippet in Rules.mak:
UCLIBC_LDSO_NAME := ld-uClibc
ARCH_NATIVE_BIT := 32
ifneq ($(findstring $(TARGET_ARCH) , hppa64 ia64 powerpc64 s390x sparc64 x86_64 kvx ),)
UCLIBC_LDSO_NAME := ld64-uClibc
ARCH_NATIVE_BIT := 64
else
ifeq ($(CONFIG_MIPS_N64_ABI),y)
UCLIBC_LDSO_NAME := ld64-uClibc
ARCH_NATIVE_BIT := 64
endif
endif
I was surprised not to see aarch64 in the list of 64-bit architectures
here. Turns out that the situation is not that simple in fact. Indeed,
gcc does not expect all 64-bit architecture to have their dynamic
loader called ld64-uClibc. For aarch64 specifically, it indeed assumes
the dynamic loader is called ld-uClibc, which explains why it is
working today.
However, it means that ARCH_NATIVE_BIT is defined to 32 on aarch64,
which is obviously (?) wrong.
But turns out that ARCH_NATIVE_BIT is only used in utils/porting.h to
define __WORDSIZE and __WORDSIZE is only used in utils/ldd.c.
So to me, it seems like this would gain in being clarified. Something
like (completely untested):
diff --git a/Rules.mak b/Rules.mak
index 3fb64c728..a0b012d7f 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -142,17 +142,8 @@ export MAJOR_VERSION MINOR_VERSION SUBLEVEL VERSION ABI_VERSION LC_ALL
LIBC := libc
SHARED_LIBNAME := $(LIBC).so.$(ABI_VERSION)
-UCLIBC_LDSO_NAME := ld-uClibc
-ARCH_NATIVE_BIT := 32
-ifneq ($(findstring $(TARGET_ARCH) , hppa64 ia64 powerpc64 s390x sparc64 x86_64 kvx ),)
-UCLIBC_LDSO_NAME := ld64-uClibc
-ARCH_NATIVE_BIT := 64
-else
-ifeq ($(CONFIG_MIPS_N64_ABI),y)
-UCLIBC_LDSO_NAME := ld64-uClibc
-ARCH_NATIVE_BIT := 64
-endif
-endif
+UCLIBC_LDSO_NAME := $(call qstrip,$(TARGET_LDSO_NAME))
+ARCH_NATIVE_BIT := $(call qstrip,$(TARGET_ARCH_BITS))
UCLIBC_LDSO := $(UCLIBC_LDSO_NAME).so.$(ABI_VERSION)
NONSHARED_LIBNAME := uclibc_nonshared.a
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index a49278b30..e6369bd82 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -145,6 +145,26 @@ config TARGET_xtensa
endchoice
+config TARGET_LDSO_NAME
+ string
+ default "ld64-uClibc" if TARGET_ia64
+ default "ld64-uClibc" if TARGET_powerpc64
+ default "ld64-uClibc" if TARGET_sparc64
+ default "ld64-uClibc" if TARGET_x86_64
+ default "ld64-uClibc" if TARGET_kvx
+ default "ld64-uClibc" if CONFIG_MIPS_N64_ABI
+ default "ld-uClibc"
+
+config TARGET_ARCH_BITS
+ int
+ default 64 if TARGET_aarch64
+ default 64 if TARGET_ia64
+ default 64 if TARGET_powerpc64
+ default 64 if TARGET_sparc64
+ default 64 if TARGET_x86_64
+ default 64 if TARGET_kvx
+ default 64 if CONFIG_MIPS_N64_ABI
+ default 32
menu "Target Architecture Features and Options"
Best regards,
Thomas Petazzoni
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
Hello,
uClibc-ng is missing the definition of RUSAGE_THREAD. It is available
in glibc:
sysdeps/unix/sysv/linux/alpha/bits/resource.h: RUSAGE_THREAD = 1
sysdeps/unix/sysv/linux/bits/resource.h: RUSAGE_THREAD = 1
sysdeps/unix/sysv/linux/mips/bits/resource.h: RUSAGE_THREAD = 1
sysdeps/unix/sysv/linux/sparc/bits/resource.h: RUSAGE_THREAD = 1
We have a real-world usage of RUSAGE_THREAD by the pistache project,
https://github.com/oktal/pistache.
Best regards,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com