From 4551169f831b3b41c5ab40d5c8c94d22e479a41c Mon Sep 17 00:00:00 2001
From: Richard Sandiford <richard@codesourcery.com>
Date: Sun, 29 Oct 2006 11:13:14 +0000
Subject: [PATCH] configure.ac (HAVE_AS_NO_SHARED): New AC_DEFINE.

gcc/
	* configure.ac (HAVE_AS_NO_SHARED): New AC_DEFINE.  Test for the
	-mno-shared assembler option on mips targets.
	* configure, config.in: Regenerate.
	* config/mips/linux.h (NO_SHARED_SPECS): New macro.
	(DRIVER_SELF_SPECS): Define to NO_SHARED_SPECS if non-empty.
	* config/mips/linux64.h (DRIVER_SELF_SPECS): Include NO_SHARED_SPECS.

From-SVN: r118138
---
 gcc/ChangeLog             |  9 +++++++++
 gcc/config.in             |  6 ++++++
 gcc/config/mips/linux.h   |  9 +++++++++
 gcc/config/mips/linux64.h |  2 ++
 gcc/configure             | 36 ++++++++++++++++++++++++++++++++++++
 gcc/configure.ac          |  4 ++++
 6 files changed, 66 insertions(+)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 20b251ce597c..ce69fe704c5e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2006-10-29  Richard Sandiford  <richard@codesourcery.com>
+
+	* configure.ac (HAVE_AS_NO_SHARED): New AC_DEFINE.  Test for the
+	-mno-shared assembler option on mips targets.
+	* configure, config.in: Regenerate.
+	* config/mips/linux.h (NO_SHARED_SPECS): New macro.
+	(DRIVER_SELF_SPECS): Define to NO_SHARED_SPECS if non-empty.
+	* config/mips/linux64.h (DRIVER_SELF_SPECS): Include NO_SHARED_SPECS.
+
 2006-10-29  Richard Sandiford  <richard@codesourcery.com>
 
 	* config/mips/mips.c (mips_classify_symbol): Test DECL_WEAK as well
diff --git a/gcc/config.in b/gcc/config.in
index 91146bb21428..2fc11775ddec 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -239,6 +239,12 @@
 #endif
 
 
+/* Define if the assembler understands -mno-shared. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_NO_SHARED
+#endif
+
+
 /* Define if your assembler supports offsetable %lo(). */
 #ifndef USED_FOR_TARGET
 #undef HAVE_AS_OFFSETABLE_LO10
diff --git a/gcc/config/mips/linux.h b/gcc/config/mips/linux.h
index bed5e316dd02..f84867a1cf3b 100644
--- a/gcc/config/mips/linux.h
+++ b/gcc/config/mips/linux.h
@@ -179,3 +179,12 @@ Boston, MA 02110-1301, USA.  */
   %{profile:-lc_p} %{!profile: -lc}}"
 
 #define MD_UNWIND_SUPPORT "config/mips/linux-unwind.h"
+
+#ifdef HAVE_AS_NO_SHARED
+/* Default to -mno-shared for non-PIC.  */
+#define NO_SHARED_SPECS \
+  "%{mshared|mno-shared|fpic|fPIC|fpie|fPIE:;:-mno-shared}",
+#define DRIVER_SELF_SPECS NO_SHARED_SPECS
+#else
+#define NO_SHARED_SPECS
+#endif
diff --git a/gcc/config/mips/linux64.h b/gcc/config/mips/linux64.h
index 4ccf93853974..8c189ffa9cbe 100644
--- a/gcc/config/mips/linux64.h
+++ b/gcc/config/mips/linux64.h
@@ -21,7 +21,9 @@ Boston, MA 02110-1301, USA.  */
 
 /* Force the default endianness and ABI flags onto the command line
    in order to make the other specs easier to write.  */
+#undef DRIVER_SELF_SPECS
 #define DRIVER_SELF_SPECS \
+NO_SHARED_SPECS \
 "%{!EB:%{!EL:%(endian_spec)}}", \
 "%{!mabi=*: -mabi=n32}"
 
diff --git a/gcc/configure b/gcc/configure
index 54a2a17feca7..cbf94b59f806 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -15589,6 +15589,42 @@ if test $gcc_cv_as_mips_explicit_relocs = yes; then
        then target_cpu_default=MASK_EXPLICIT_RELOCS
        else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS"
        fi
+fi
+    echo "$as_me:$LINENO: checking assembler for -mno-shared support" >&5
+echo $ECHO_N "checking assembler for -mno-shared support... $ECHO_C" >&6
+if test "${gcc_cv_as_mips_no_shared+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  gcc_cv_as_mips_no_shared=no
+    if test $in_tree_gas = yes; then
+    if test $gcc_cv_gas_vers -ge `expr \( \( 2 \* 1000 \) + 16 \) \* 1000 + 0`
+  then gcc_cv_as_mips_no_shared=yes
+fi
+  elif test x$gcc_cv_as != x; then
+    echo 'nop' > conftest.s
+    if { ac_try='$gcc_cv_as -mno-shared -o conftest.o conftest.s >&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }
+    then
+	gcc_cv_as_mips_no_shared=yes
+    else
+      echo "configure: failed program was" >&5
+      cat conftest.s >&5
+    fi
+    rm -f conftest.o conftest.s
+  fi
+fi
+echo "$as_me:$LINENO: result: $gcc_cv_as_mips_no_shared" >&5
+echo "${ECHO_T}$gcc_cv_as_mips_no_shared" >&6
+if test $gcc_cv_as_mips_no_shared = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_AS_NO_SHARED 1
+_ACEOF
+
 fi
     ;;
 esac
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 1dafd858f7b6..0b42531ff6d5 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -2952,6 +2952,10 @@ LCF0:
        then target_cpu_default=MASK_EXPLICIT_RELOCS
        else target_cpu_default="($target_cpu_default)|MASK_EXPLICIT_RELOCS"
        fi])
+    gcc_GAS_CHECK_FEATURE([-mno-shared support],
+      gcc_cv_as_mips_no_shared, [2,16,0], [-mno-shared], [nop],,
+      [AC_DEFINE(HAVE_AS_NO_SHARED, 1,
+		 [Define if the assembler understands -mno-shared.])])
     ;;
 esac
 
-- 
GitLab