# HG changeset patch
# Parent d2202c84f6ecdf3980dc94ba513be676b4015819
Build libgo with -Wa,-nH if possible (PR go/78978)
@@ -1,3 +1,35 @@
+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=''
+
+ # 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.
@@ -42,14 +42,12 @@ ACLOCAL_AMFLAGS = -I ./config -I ../conf
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.
@@ -421,9 +421,6 @@ case "$target" in
esac
AC_SUBST(OSCFLAGS)
-dnl Check linker hardware capability support.
-GCC_CHECK_LINKER_HWCAP
-
case "$target" in
*86*-*-solaris2.1[[1-9]]*)
# Link with -shared-libgcc on Solaris 11+/x86 as a workaround for
@@ -433,6 +430,9 @@ case "$target" in
esac
AC_SUBST(OSLDFLAGS)
+# 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],
[libgo_cv_c_split_stack_supported],
@@ -169,38 +169,6 @@ AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURE
dnl
-dnl Check if the assembler used supports disabling generation of hardware
-dnl capabilities. This is only supported by Sun as at the moment.
-dnl
-dnl Defines:
-dnl HWCAP_FLAGS='-Wa,-nH' if possible.
-dnl
-AC_DEFUN([GLIBCXX_CHECK_ASSEMBLER_HWCAP], [
- test -z "$HWCAP_FLAGS" && HWCAP_FLAGS=''
-
- # 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_FLAGS="-Wa,-nH $HWCAP_FLAGS"
- fi
- AC_MSG_RESULT($ac_hwcap_flags)
-
- CFLAGS="$ac_save_CFLAGS"
- ;;
- esac
-
- AC_SUBST(HWCAP_FLAGS)
-])
-
-
-dnl
dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
dnl the native linker is in use, all variables will be defined to something
dnl safe (like an empty string).
@@ -400,7 +400,7 @@ AC_SUBST(LONG_DOUBLE_COMPAT_FLAGS)
GLIBCXX_CONDITIONAL(GLIBCXX_LDBL_COMPAT, test $ac_ldbl_compat = yes)
# Check if assembler supports disabling hardware capability support.
-GLIBCXX_CHECK_ASSEMBLER_HWCAP
+GCC_CHECK_ASSEMBLER_HWCAP
# Check if assembler supports rdrand opcode.
GLIBCXX_CHECK_X86_RDRAND
@@ -28,7 +28,7 @@ endif
# These bits are all figured out from configure. Look in acinclude.m4
# or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS.
CONFIG_CXXFLAGS = \
- $(SECTION_FLAGS) $(HWCAP_FLAGS) -frandom-seed=$@
+ $(SECTION_FLAGS) $(HWCAP_CFLAGS) -frandom-seed=$@
WARN_CXXFLAGS = \
$(WARN_FLAGS) $(WERROR_FLAG) -fdiagnostics-show-location=once