[glibc] Filter out internal abort during ld.so build

Adhemerval Zanella azanella@sourceware.org
Mon Nov 10 12:04:13 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=50000da305a64532f5ac39bc79ef93cb6bdabd22

commit 50000da305a64532f5ac39bc79ef93cb6bdabd22
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Fri Oct 31 17:00:49 2025 -0300

    Filter out internal abort during ld.so build
    
    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.
    
    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 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 a690974537..df51b0c1a3 100755
--- a/configure
+++ b/configure
@@ -9027,6 +9027,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.
@@ -9609,6 +9610,9 @@ if test "$libc_cv_attr_after_func_decl" = 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 2409f07dc9..dd0b7a4c7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1967,6 +1967,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.
@@ -2252,6 +2253,8 @@ if test "$libc_cv_attr_after_func_decl" = yes; then
    AC_DEFINE(ATTR_AFTER_FUNC_DECL)
 fi
 
+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 7ed95b72af..bcdc6aa625 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1487,6 +1487,13 @@ rtld-stubbed-symbols = \
   realloc \
   # 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


More information about the Glibc-cvs mailing list