gcc/config/hwcaps.m4
Rainer Orth f2c52c0dfd libiberty: Disable hwcaps for sha1.o
This patch

commit bf4f40cc31
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Nov 28 13:14:05 2023 +0100

    libiberty: Use x86 HW optimized sha1

broke Solaris/x86 bootstrap with the native as:

libtool: compile:  /var/gcc/regression/master/11.4-gcc/build/./gcc/gccgo -B/var/gcc/regression/master/11.4-gcc/build/./gcc/ -B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/ -isystem /vol/gcc/i386-pc-solaris2.11/include -isystem /vol/gcc/i386-pc-solaris2.11/sys-include -fchecking=1 -minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=internal/goarch /vol/gcc/src/hg/master/local/libgo/go/internal/goarch/goarch.go zgoarch.go
ld.so.1: go1: fatal: /var/gcc/regression/master/11.4-gcc/build/gcc/go1: hardware capability (CA_SUNW_HW_2) unsupported: 0x4000000  [ SHA1 ]
gccgo: fatal error: Killed signal terminated program go1

As is already done in a couple of other similar cases, this patches
disables hwcaps support for libiberty.

Initially, this didn't work because config/hwcaps.m4 uses target_os, but
didn't ensure it is defined.

Tested on i386-pc-solaris2.11 with as and gas.

2023-11-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	config:
	* hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): Require
	AC_CANONICAL_TARGET.

	libiberty:
	* configure.ac (GCC_CHECK_ASSEMBLER_HWCAP): Invoke.
	* configure, aclocal.m4: Regenerate.
	* Makefile.in (COMPILE.c): Add HWCAP_CFLAGS.
2023-11-30 10:06:23 +01:00

62 lines
1.6 KiB
Plaintext

dnl
dnl Check if the assembler used supports disabling generation of hardware
dnl capabilities. This is only supported by Solaris as at the moment.
dnl
dnl Defines:
dnl HWCAP_CFLAGS='-Wa,-nH' if possible.
dnl
AC_DEFUN([GCC_CHECK_ASSEMBLER_HWCAP], [
test -z "$HWCAP_CFLAGS" && HWCAP_CFLAGS=''
AC_REQUIRE([AC_CANONICAL_TARGET])
# Restrict the test to Solaris, other assemblers (e.g. AIX as) have -nH
# with a different meaning.
case ${target_os} in
solaris2*)
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wa,-nH"
AC_MSG_CHECKING([for as that supports -Wa,-nH])
AC_TRY_COMPILE([], [return 0;], [ac_hwcap_flags=yes],[ac_hwcap_flags=no])
if test "$ac_hwcap_flags" = "yes"; then
HWCAP_CFLAGS="-Wa,-nH $HWCAP_CFLAGS"
fi
AC_MSG_RESULT($ac_hwcap_flags)
CFLAGS="$ac_save_CFLAGS"
;;
esac
AC_SUBST(HWCAP_CFLAGS)
])
dnl
dnl Check if the linker used supports linker maps to clear hardware
dnl capabilities. This is only supported on Solaris at the moment.
dnl
dnl Defines:
dnl HWCAP_LDFLAGS=-mclear-hwcap if possible
dnl LD (as a side effect of testing)
dnl
AC_DEFUN([GCC_CHECK_LINKER_HWCAP], [
test -z "$HWCAP_LDFLAGS" && HWCAP_LDFLAGS=''
AC_REQUIRE([AC_PROG_LD])
ac_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LFLAGS -mclear-hwcap"
AC_MSG_CHECKING([for -mclear-hwcap])
AC_TRY_LINK([], [return 0;], [ac_hwcap_ldflags=yes],[ac_hwcap_ldflags=no])
if test "$ac_hwcap_ldflags" = "yes"; then
HWCAP_LDFLAGS="-mclear-hwcap $HWCAP_LDFLAGS"
fi
AC_MSG_RESULT($ac_hwcap_ldflags)
LDFLAGS="$ac_save_LDFLAGS"
AC_SUBST(HWCAP_LDFLAGS)
AM_CONDITIONAL(HAVE_HWCAP, test $ac_hwcap_ldflags != no)
])