public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] libiberty: Disable hwcaps for sha1.o
@ 2023-11-30  9:15 Rainer Orth
  0 siblings, 0 replies; only message in thread
From: Rainer Orth @ 2023-11-30  9:15 UTC (permalink / raw)
  To: bfd-cvs, gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=56006f79386f261f637809296585153b09f84ee1

commit 56006f79386f261f637809296585153b09f84ee1
Author: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Date:   Thu Nov 30 10:14:30 2023 +0100

    libiberty: Disable hwcaps for sha1.o
    
    This patch
    
    commit bf4f40cc3195eb7b900bf5535cdba1ee51fdbb8e
    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.

Diff:
---
 config/ChangeLog       |  5 +++
 config/hwcaps.m4       |  1 +
 libiberty/ChangeLog    |  6 ++++
 libiberty/Makefile.in  |  2 +-
 libiberty/aclocal.m4   |  2 ++
 libiberty/configure    | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++
 libiberty/configure.ac |  2 ++
 7 files changed, 108 insertions(+), 1 deletion(-)

diff --git a/config/ChangeLog b/config/ChangeLog
index bb82cc873ea..b8943c95cad 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,8 @@
+2023-11-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	* hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): Require
+	AC_CANONICAL_TARGET.
+
 2023-11-15  Arsen Arsenović  <arsen@aarsen.me>
 
 	* intlmacosx.m4: Import from gettext-0.22 (serial 8).
diff --git a/config/hwcaps.m4 b/config/hwcaps.m4
index ff352fdd3a6..33f090574cf 100644
--- a/config/hwcaps.m4
+++ b/config/hwcaps.m4
@@ -7,6 +7,7 @@ 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.
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index a8fdc1b8f0e..3258d1a46f4 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,9 @@
+2023-11-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	* configure.ac (GCC_CHECK_ASSEMBLER_HWCAP): Invoke.
+	* configure, aclocal.m4: Regenerate.
+	* Makefile.in (COMPILE.c): Add HWCAP_CFLAGS.
+
 2023-11-28  Jakub Jelinek  <jakub@redhat.com>
 
 	* configure.ac (HAVE_X86_SHA1_HW_SUPPORT): New check.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index f9fbba23e2c..d7e2d79f047 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -114,7 +114,7 @@ INCDIR=$(srcdir)/$(MULTISRCTOP)../include
 
 COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) \
                $(HDEFINES) @ac_libiberty_warn_cflags@ -D_GNU_SOURCE \
-               @CET_HOST_FLAGS@
+               @CET_HOST_FLAGS@ @HWCAP_CFLAGS@
 
 # Just to make sure we don't use a built-in rule with VPATH
 .c.$(objext):
diff --git a/libiberty/aclocal.m4 b/libiberty/aclocal.m4
index 0757688d52a..364fb6bc3b4 100644
--- a/libiberty/aclocal.m4
+++ b/libiberty/aclocal.m4
@@ -16,7 +16,9 @@ m4_include([../config/acx.m4])
 m4_include([../config/cet.m4])
 m4_include([../config/enable.m4])
 m4_include([../config/gcc-plugin.m4])
+m4_include([../config/hwcaps.m4])
 m4_include([../config/no-executables.m4])
+m4_include([../config/override.m4])
 m4_include([../config/picflag.m4])
 m4_include([../config/warnings.m4])
 m4_include([acinclude.m4])
diff --git a/libiberty/configure b/libiberty/configure
index 9cdf802539e..d39b1b71233 100755
--- a/libiberty/configure
+++ b/libiberty/configure
@@ -626,6 +626,11 @@ pexecute
 target_header_dir
 CHECK
 LIBOBJS
+HWCAP_CFLAGS
+target_os
+target_vendor
+target_cpu
+target
 CET_HOST_FLAGS
 NOASANFLAG
 PICFLAG
@@ -1325,6 +1330,7 @@ _ACEOF
 System types:
   --build=BUILD     configure for building on BUILD [guessed]
   --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
 _ACEOF
 fi
 
@@ -2462,6 +2468,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+
+
+
 # This works around the fact that libtool configuration may change LD
 # for this particular configuration, but some shells, instead of
 # keeping the changes in LD private, export them just because LD is
@@ -5631,6 +5640,88 @@ LDFLAGS="$cet_save_LDFLAGS"
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if ${ac_cv_target+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$target_alias" = x; then
+  ac_cv_target=$ac_cv_host
+else
+  ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
+case $ac_cv_target in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;;
+esac
+target=$ac_cv_target
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_target
+shift
+target_cpu=$1
+target_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+target_os=$*
+IFS=$ac_save_IFS
+case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+  test -z "$HWCAP_CFLAGS" && HWCAP_CFLAGS=''
+
+
+  # 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"
+
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for as that supports -Wa,-nH" >&5
+$as_echo_n "checking for as that supports -Wa,-nH... " >&6; }
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hwcap_flags=yes
+else
+  ac_hwcap_flags=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      if test "$ac_hwcap_flags" = "yes"; then
+	HWCAP_CFLAGS="-Wa,-nH $HWCAP_CFLAGS"
+      fi
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_hwcap_flags" >&5
+$as_echo "$ac_hwcap_flags" >&6; }
+
+      CFLAGS="$ac_save_CFLAGS"
+      ;;
+  esac
+
+
+
+
 echo "# Warning: this fragment is automatically generated" > temp-frag
 
 if [ -n "${frag}" ] && [ -f "${frag}" ]; then
diff --git a/libiberty/configure.ac b/libiberty/configure.ac
index e07cbb8aabf..cf2c9703781 100644
--- a/libiberty/configure.ac
+++ b/libiberty/configure.ac
@@ -265,6 +265,8 @@ AC_SUBST(NOASANFLAG)
 GCC_CET_HOST_FLAGS(CET_HOST_FLAGS)
 AC_SUBST(CET_HOST_FLAGS)
 
+GCC_CHECK_ASSEMBLER_HWCAP
+
 echo "# Warning: this fragment is automatically generated" > temp-frag
 
 if [[ -n "${frag}" ]] && [[ -f "${frag}" ]]; then

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-30  9:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30  9:15 [binutils-gdb] libiberty: Disable hwcaps for sha1.o Rainer Orth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).