From 752d29d62445fdf8b77a75cdc91cf1f749841234 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sun, 24 Sep 2023 14:14:17 +0100 Subject: [PATCH] GCC: disable dl_iterate_phdr in libbacktrace On Haiku, this is now available as part of libbsd. The build system for libbacktrace does not know about this library. In a regular build this does not matter, as the test in the configure script will fail to compile. However, when libbacktrace is built as a target library, only the existence of the method in link.h is tested, which will succeed. This lead to libgfortan.so having undefined references. See: https://github.com/haikuports/haikuports/issues/9241 Change-Id: I576d7802d43e11787b3bc1d09c89a42bf982dc3b Reviewed-on: https://review.haiku-os.org/c/buildtools/+/6950 Reviewed-by: waddlesplash --- gcc/libbacktrace/configure | 5 +++++ gcc/libbacktrace/configure.ac | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/gcc/libbacktrace/configure b/gcc/libbacktrace/configure index 6af2c04c81..dc1bf68d14 100755 --- a/gcc/libbacktrace/configure +++ b/gcc/libbacktrace/configure @@ -13331,6 +13331,11 @@ else have_dl_iterate_phdr=no fi rm -f conftest* + # On Haiku, this function only exists when linking against libbsd. This + # may be enabled in the future, but for now, disable support. + case "${host}" in + *-*-haiku*) have_dl_iterate_phdr=no ;; + esac else ac_fn_c_check_func "$LINENO" "dl_iterate_phdr" "ac_cv_func_dl_iterate_phdr" diff --git a/gcc/libbacktrace/configure.ac b/gcc/libbacktrace/configure.ac index 39e6bf41e3..032341812f 100644 --- a/gcc/libbacktrace/configure.ac +++ b/gcc/libbacktrace/configure.ac @@ -347,6 +347,11 @@ else # When built as a GCC target library, we can't do a link test. AC_EGREP_HEADER([dl_iterate_phdr], [$link_h], [have_dl_iterate_phdr=yes], [have_dl_iterate_phdr=no]) + # On Haiku, this function only exists when linking against libbsd. This + # may be enabled in the future, but for now, disable support. + case "${host}" in + *-*-haiku*) have_dl_iterate_phdr=no ;; + esac else AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes], [have_dl_iterate_phdr=no])