aboutsummaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-06 16:04:01 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-06 16:04:01 +0000
commitf7b28005c6bea3d4c4002b2df187bb2bf28d2bc5 (patch)
tree10d4a7092944ea178088d808d553d35c8b6effe1 /libgo
parent34e0967df228dbc7c400734477a26b31d72516be (diff)
PR go/78978
libgo: build with -Wa,-nH if possible on Solaris By default the Solaris assembler records the required hardware capability in the object file. This means that the AES hashing code breaks on systems that do not support AES, even though the code uses a runtime check to only actually invoke the AES instructions on systems that support it. An earlier fix for the problem only fixed the shared library, not the static libgo.a. Fix the problem for real by using an assembler option to not record the hardware capability. For GCC PR 78978. Patch by Rainer Orth. Reviewed-on: https://go-review.googlesource.com/34910 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244165 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/Makefile.am6
-rw-r--r--libgo/Makefile.in13
-rwxr-xr-xlibgo/configure61
-rw-r--r--libgo/configure.ac4
-rw-r--r--libgo/testsuite/Makefile.in2
5 files changed, 36 insertions, 50 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 1f5a0212a82..93eaa9f2046 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -42,14 +42,12 @@ ACLOCAL_AMFLAGS = -I ./config -I ../config
AM_CFLAGS = -fexceptions -fnon-call-exceptions -fplan9-extensions \
$(SPLIT_STACK) $(WARN_CFLAGS) \
- $(STRINGOPS_FLAG) $(OSCFLAGS) \
+ $(STRINGOPS_FLAG) $(HWCAP_CFLAGS) $(OSCFLAGS) \
-I $(srcdir)/../libgcc -I $(srcdir)/../libbacktrace \
-I $(MULTIBUILDTOP)../../gcc/include
-AM_LDFLAGS = $(HWCAP_LDFLAGS)
-
if USING_SPLIT_STACK
-AM_LDFLAGS += -XCClinker $(SPLIT_STACK)
+AM_LDFLAGS = -XCClinker $(SPLIT_STACK)
endif
# Multilib support.
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index a161fd7f2fa..424e41b6333 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -62,9 +62,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-@USING_SPLIT_STACK_TRUE@am__append_1 = -XCClinker $(SPLIT_STACK)
-@GOC_IS_LLGO_TRUE@am__append_2 = libgo-llgo.la libgobegin-llgo.a
-@GOC_IS_LLGO_FALSE@am__append_3 = libgo.la libgobegin.a
+@GOC_IS_LLGO_TRUE@am__append_1 = libgo-llgo.la libgobegin-llgo.a
+@GOC_IS_LLGO_FALSE@am__append_2 = libgo.la libgobegin.a
subdir = .
DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
@@ -321,7 +320,7 @@ GO_SPLIT_STACK = @GO_SPLIT_STACK@
GO_SYSCALL_OS_ARCH_FILE = @GO_SYSCALL_OS_ARCH_FILE@
GO_SYSCALL_OS_FILE = @GO_SYSCALL_OS_FILE@
GREP = @GREP@
-HWCAP_LDFLAGS = @HWCAP_LDFLAGS@
+HWCAP_CFLAGS = @HWCAP_CFLAGS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -459,11 +458,11 @@ AM_CPPFLAGS = -I $(srcdir)/runtime $(LIBFFIINCS) $(PTHREAD_CFLAGS)
ACLOCAL_AMFLAGS = -I ./config -I ../config
AM_CFLAGS = -fexceptions -fnon-call-exceptions -fplan9-extensions \
$(SPLIT_STACK) $(WARN_CFLAGS) \
- $(STRINGOPS_FLAG) $(OSCFLAGS) \
+ $(STRINGOPS_FLAG) $(HWCAP_CFLAGS) $(OSCFLAGS) \
-I $(srcdir)/../libgcc -I $(srcdir)/../libbacktrace \
-I $(MULTIBUILDTOP)../../gcc/include
-AM_LDFLAGS = $(HWCAP_LDFLAGS) $(am__append_1)
+@USING_SPLIT_STACK_TRUE@AM_LDFLAGS = -XCClinker $(SPLIT_STACK)
# Multilib support.
MAKEOVERRIDES =
@@ -1120,7 +1119,7 @@ CHECK_DEPS = $(toolexeclibgo_DATA) $(toolexeclibgoarchive_DATA) \
$(toolexeclibgorpc_DATA) $(toolexeclibgoruntime_DATA) \
$(toolexeclibgosync_DATA) $(toolexeclibgotesting_DATA) \
$(toolexeclibgotext_DATA) $(toolexeclibgotexttemplate_DATA) \
- $(toolexeclibgounicode_DATA) $(am__append_2) $(am__append_3)
+ $(toolexeclibgounicode_DATA) $(am__append_1) $(am__append_2)
# Pass -ffp-contract=off, or 386-specific options, when building the
# math package. MATH_FLAG is defined in configure.ac.
diff --git a/libgo/configure b/libgo/configure
index 2cd390859bb..06532d30891 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -624,9 +624,7 @@ GO_SPLIT_STACK
USING_SPLIT_STACK_FALSE
USING_SPLIT_STACK_TRUE
SPLIT_STACK
-HAVE_HWCAP_FALSE
-HAVE_HWCAP_TRUE
-HWCAP_LDFLAGS
+HWCAP_CFLAGS
OSCFLAGS
GO_SYSCALL_OS_ARCH_FILE
GO_SYSCALL_OS_FILE
@@ -11106,7 +11104,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11109 "configure"
+#line 11107 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11212,7 +11210,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11215 "configure"
+#line 11213 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13912,15 +13910,18 @@ esac
- test -z "$HWCAP_LDFLAGS" && HWCAP_LDFLAGS=''
+ 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"
- ac_save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LFLAGS -mclear-hwcap"
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mclear-hwcap" >&5
-$as_echo_n "checking for -mclear-hwcap... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ { $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
@@ -13931,31 +13932,23 @@ return 0;
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_hwcap_ldflags=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hwcap_flags=yes
else
- ac_hwcap_ldflags=no
+ ac_hwcap_flags=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- if test "$ac_hwcap_ldflags" = "yes"; then
- HWCAP_LDFLAGS="-mclear-hwcap $HWCAP_LDFLAGS"
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_hwcap_ldflags" >&5
-$as_echo "$ac_hwcap_ldflags" >&6; }
-
- LDFLAGS="$ac_save_LDFLAGS"
+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
- if test $ac_hwcap_ldflags != no; then
- HAVE_HWCAP_TRUE=
- HAVE_HWCAP_FALSE='#'
-else
- HAVE_HWCAP_TRUE='#'
- HAVE_HWCAP_FALSE=
-fi
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -fsplit-stack is supported" >&5
@@ -15764,10 +15757,6 @@ if test -z "${LIBGO_IS_BSD_TRUE}" && test -z "${LIBGO_IS_BSD_FALSE}"; then
as_fn_error "conditional \"LIBGO_IS_BSD\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${HAVE_HWCAP_TRUE}" && test -z "${HAVE_HWCAP_FALSE}"; then
- as_fn_error "conditional \"HAVE_HWCAP\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
if test -z "${USING_SPLIT_STACK_TRUE}" && test -z "${USING_SPLIT_STACK_FALSE}"; then
as_fn_error "conditional \"USING_SPLIT_STACK\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git a/libgo/configure.ac b/libgo/configure.ac
index a3267308ed1..6deafda68f1 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -421,8 +421,8 @@ case "$target" in
esac
AC_SUBST(OSCFLAGS)
-dnl Check linker hardware capability support.
-GCC_CHECK_LINKER_HWCAP
+dnl Check if assembler supports disabling hardware capability support.
+GCC_CHECK_ASSEMBLER_HWCAP
dnl Use -fsplit-stack when compiling C code if available.
AC_CACHE_CHECK([whether -fsplit-stack is supported],
diff --git a/libgo/testsuite/Makefile.in b/libgo/testsuite/Makefile.in
index f059021ee48..79da1c91ff6 100644
--- a/libgo/testsuite/Makefile.in
+++ b/libgo/testsuite/Makefile.in
@@ -124,7 +124,7 @@ GO_SPLIT_STACK = @GO_SPLIT_STACK@
GO_SYSCALL_OS_ARCH_FILE = @GO_SYSCALL_OS_ARCH_FILE@
GO_SYSCALL_OS_FILE = @GO_SYSCALL_OS_FILE@
GREP = @GREP@
-HWCAP_LDFLAGS = @HWCAP_LDFLAGS@
+HWCAP_CFLAGS = @HWCAP_CFLAGS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@