On Thu, Jan 19, 2012 at 09:54:43AM +0100, Paolo Bonzini wrote: > On 01/19/2012 12:24 AM, Jakub Jelinek wrote: > > if test "x${build}" = "x${target}"&& test "x${build}" = "x${host}"; then > > This test is no longer necessary, is it? ia64 does its own > cross-compile detection via AC_RUN_IFELSE, and other hosts are > cross-compile safe. The patch is okay if you remove it.
While the linker test is done using the target linker (it uses default linker flags btw, so in case a linker would be buggy for one target and not for a different target also supported by the same linker, it would be a problem, but let's assume that the linker is either buggy or not for all targets it supports), AC_PREPROC_IFELSE is done using the host compiler. For cross-compiling we would need to check the target libc headers. For glibc we could certainly do something similar to the case "$target" in *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) [# glibc 2.4 and later provides __stack_chk_fail and # either __stack_chk_guard, or TLS access to stack guard canary. if test -f $target_header_dir/features.h \ && $EGREP '^[ ]*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \ $target_header_dir/features.h > /dev/null; then if $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+([1-9][0-9]|[3-9])' \ $target_header_dir/features.h > /dev/null; then gcc_cv_libc_provides_ssp=yes elif $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+2' \ $target_header_dir/features.h > /dev/null \ && $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[4-9])' \ $target_header_dir/features.h > /dev/null; then gcc_cv_libc_provides_ssp=yes fi fi] test configure already does (and glibc only supports ELF targets, so the ELF check could be avoided). > H.J., can ia64 fall back to the common test when cross compiling? > Or perhaps even always? I've kept ia64 as is because that is what we did for ia64 configure already in 4.6 and earlier. As ia64 was using .init_array etc. far before the linker merging of .ctors and .init_array has been fixed, probably it just switched over to .init_array completely many years ago or something. Jakub