summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-10-31 17:00:49 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2025-11-10 08:58:12 -0300
commit50000da305a64532f5ac39bc79ef93cb6bdabd22 (patch)
tree0d37634772d81a84c84c734fd54d5d1682222179
parente3394859eeee302edff09eb8ed0ec575aa8c5614 (diff)
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>
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac3
-rw-r--r--elf/Makefile7
-rw-r--r--sysdeps/mach/hurd/configure2
-rw-r--r--sysdeps/mach/hurd/configure.ac2
5 files changed, 18 insertions, 0 deletions
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