From: Richard Sandiford Date: Wed, 21 Apr 2021 14:36:51 +0000 (+0100) Subject: aarch64: Always use .init/.fini_array for GNU/Linux X-Git-Tag: upstream/12.2.0~8657 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7f2165c0b0d31efd1795384c4068adc17da1729;p=platform%2Fupstream%2Fgcc.git aarch64: Always use .init/.fini_array for GNU/Linux I was wondering why the (now fixed) c-c++-common/attr-retain-[78].c failures were showing up in the native results for aarch64-linux-gnu but not in the posted cross results. It turns out that .init/ .fini_array support is disabled by default for cross builds, which in turn stops those tests from running. The test for .init/fini_array support has two parts: one that builds something with the assembler and linker, and another that compiles C code and uses preprocessor macros to test the glibc version. The first test would work with build=host but the second is only safe for build=target. However, AArch64 postdates glibc and binutils support for .init/fini_array by some distance, so it's safe to hard-code the result to "yes" for cross compilers. This fixes the only material difference in auto-host.h between a native and a cross build. gcc/ * acinclude.m4 (gcc_AC_INITFINI_ARRAY): When cross-compiling, default to yes for aarch64-linux-gnu. * configure: Regenerate. --- diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4 index 74c1824..f9f6a07 100644 --- a/gcc/acinclude.m4 +++ b/gcc/acinclude.m4 @@ -422,8 +422,18 @@ changequote([,])dnl ])],, [gcc_cv_initfini_array=no]);; esac else - AC_MSG_CHECKING(cross compile... guessing) - gcc_cv_initfini_array=no + case "${target}" in + aarch64*-linux-gnu*) + # AArch64 postdates glibc support for .init_array/.fini_array, + # so we don't need the preprocessor test above. + gcc_cv_initfini_array=yes + ;; + + *) + AC_MSG_CHECKING(cross compile... guessing) + gcc_cv_initfini_array=no + ;; + esac fi]) enable_initfini_array=$gcc_cv_initfini_array ]) diff --git a/gcc/configure b/gcc/configure index e8ecb3b..33eae54 100755 --- a/gcc/configure +++ b/gcc/configure @@ -24132,9 +24132,19 @@ fi rm -f conftest.err conftest.i conftest.$ac_ext;; esac else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking cross compile... guessing" >&5 + case "${target}" in + aarch64*-linux-gnu*) + # AArch64 postdates glibc support for .init_array/.fini_array, + # so we don't need the preprocessor test above. + gcc_cv_initfini_array=yes + ;; + + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking cross compile... guessing" >&5 $as_echo_n "checking cross compile... guessing... " >&6; } - gcc_cv_initfini_array=no + gcc_cv_initfini_array=no + ;; + esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_initfini_array" >&5