[PATCH v2 25/28] Filter out internal abort during ld.so build
Adhemerval Zanella
adhemerval.zanella@linaro.org
Tue Oct 28 17:08:34 GMT 2025
clang might generate an abort call when cleanup functions (set by
__attribute__ ((cleanup)) calls functions not marked as nothrow.
The hurd already provides abort for the loader at
sysdeps/mach/hurd/dl-sysdep.c, and adding it rtld-stubbed-symbols
triggers duplicate symbols.
---
configure | 4 ++++
configure.ac | 3 +++
elf/Makefile | 7 +++++++
sysdeps/mach/hurd/configure | 2 ++
sysdeps/mach/hurd/configure.ac | 2 ++
5 files changed, 18 insertions(+)
diff --git a/configure b/configure
index 122020db69..3c926be3ec 100755
--- a/configure
+++ b/configure
@@ -8915,6 +8915,7 @@ libc_cv_localstatedir=$localstatedir
libc_cv_gcc_unwind_find_fde=no
libc_cv_idn=no
pthread_in_libc=yes
+abort_in_ld=no
# Iterate over all the sysdep directories we will use, running their
# configure fragments.
@@ -9468,6 +9469,9 @@ if test "$pthread_in_libc" = yes; then
fi
+config_vars="$config_vars
+abort-in-ld = $abort_in_ld";
+
ac_config_files="$ac_config_files config.make Makefile"
ac_config_commands="$ac_config_commands default"
diff --git a/configure.ac b/configure.ac
index 14a0f2dee8..890f1b1c9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1916,6 +1916,7 @@ libc_cv_localstatedir=$localstatedir
libc_cv_gcc_unwind_find_fde=no
libc_cv_idn=no
pthread_in_libc=yes
+abort_in_ld=no
# Iterate over all the sysdep directories we will use, running their
# configure fragments.
@@ -2181,6 +2182,8 @@ if test "$pthread_in_libc" = yes; then
fi
AC_SUBST(pthread_in_libc)
+LIBC_CONFIG_VAR([abort-in-ld],[$abort_in_ld]);
+
AC_CONFIG_FILES([config.make Makefile])
AC_CONFIG_COMMANDS([default],[[
case $CONFIG_FILES in *config.make*)
diff --git a/elf/Makefile b/elf/Makefile
index dd21fe6241..e95747c795 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1495,6 +1495,13 @@ rtld-stubbed-symbols += \
__GI___vsyslog_chk \
# rtld-stubbed-symbols
+ifeq (no,$(abort-in-ld))
+# clang might generate an abort call for cleanup functions.
+rtld-stubbed-symbols += \
+ __GI_abort \
+ # rtld-stubbed-symbols
+endif
+
ifeq ($(have-ssp),yes)
# rtld is not built with the stack protector, so these references will
# go away in the rebuilds.
diff --git a/sysdeps/mach/hurd/configure b/sysdeps/mach/hurd/configure
index 6ca3bab511..743bad5fcb 100644
--- a/sysdeps/mach/hurd/configure
+++ b/sysdeps/mach/hurd/configure
@@ -220,4 +220,6 @@ fi
# Hurd has libpthread as a separate library.
pthread_in_libc=no
+# Hurd already provides abort implementation for the loader
+abort_in_ld=yes
diff --git a/sysdeps/mach/hurd/configure.ac b/sysdeps/mach/hurd/configure.ac
index 1695e94ecc..6d33feed0e 100644
--- a/sysdeps/mach/hurd/configure.ac
+++ b/sysdeps/mach/hurd/configure.ac
@@ -48,3 +48,5 @@ fi
# Hurd has libpthread as a separate library.
pthread_in_libc=no
+# Hurd already provides abort implementation for the loader
+abort_in_ld=yes
--
2.43.0
More information about the Libc-alpha
mailing list