Joseph Myers <jos...@codesourcery.com> writes:
> On Wed, 21 Apr 2021, Andreas Schwab wrote:
>
>> On Apr 21 2021, Richard Sandiford via Gcc-patches wrote:
>> 
>> > 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.
>> 
>> Should there be an automatism for any other new architecture added?

I guess it depends on whether we want this to be done automatically
only for GNU/Linux or for other OSes too.  I'm a bit nervous about
enabling it for aarch64*-elf by default.

I guess we could have:

    x86_64*-linux-gnu)
    ...all other current linux-gnu targets except aarch64....
    ...
      ...=no
      ;;

    *-*-linux-gnu*)
      ...=yes
      ;;

    *)
      ...=no
      ;;

Then other targets that are similarly “new enough” can be removed
from the first list.  New architectures would automatically be “yes”.

> See what I said in 
> <https://sourceware.org/pipermail/libc-alpha/2018-November/098712.html>.  
> I think the configure test is valid for cross compilation and doesn't need 
> to check build = host = target at all.

Are you sure?  The default (non-ia64) case includes:

        AC_PREPROC_IFELSE([AC_LANG_SOURCE([
#ifndef __ELF__
# error Not an ELF OS
#endif
#include <stdlib.h>
#if defined __GLIBC_PREREQ
# if __GLIBC_PREREQ (2, 4)
# else
#  error GLIBC 2.4 required
# endif
#else
# if defined __sun__ && defined __svr4__
   /* Solaris ld.so.1 supports .init_array/.fini_array since Solaris 8.  */
# else
#  error The C library not known to support .init_array/.fini_array
# endif
#endif
])],, [gcc_cv_initfini_array=no]);;

which AFAICT would test preprocessing for the host rather than the target.

Thanks,
Richard

Reply via email to