Check if -mcmodel=medium works
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 27 Jan 2012 23:23:37 +0000 (23:23 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 27 Jan 2012 23:23:37 +0000 (23:23 +0000)
2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>

* configure.ac: Check if -mcmodel=medium works.
* configure: Regenerated.

gold/ChangeLog
gold/configure
gold/configure.ac

index 8ff80480f764db60f576bdb70e82b8e532c7ada4..8ed05f57c39df8fe93b3800763aa1cba29b54fa2 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * configure.ac: Check if -mcmodel=medium works.
+       * configure: Regenerated.
+
 2012-01-24  Cary Coutant  <ccoutant@google.com>
 
        * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
index 3dddec67c2c5177fa93d34c38cce44f8865209de..aca7cabe9aa58cd42dcd5a8ae43b29ea1bd3f5bd 100755 (executable)
@@ -6312,7 +6312,20 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gold_cv_prog_gcc41" >&5
 $as_echo "$gold_cv_prog_gcc41" >&6; }
 
- if test "$target_cpu" = "x86_64" -a "$gold_cv_prog_gcc41" = "yes"; then
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mcmodel=medium"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int i;
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  have_mcmodel_medium=yes
+else
+  have_mcmodel_medium=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+ if test "$target_cpu" = "x86_64" -a "$have_mcmodel_medium" = "yes" -a "$gold_cv_prog_gcc41" = "yes"; then
   MCMODEL_MEDIUM_TRUE=
   MCMODEL_MEDIUM_FALSE='#'
 else
index 1b46f4a8521ae9fb3a16310a5bd55a327f98863b..e49bf211e6afcbc51b59d52502873046c1483fb7 100644 (file)
@@ -312,9 +312,13 @@ error
 #endif
 ], [gold_cv_prog_gcc41=yes], [gold_cv_prog_gcc41=no])])
 
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -mcmodel=medium"
+AC_COMPILE_IFELSE([int i;], [have_mcmodel_medium=yes], [have_mcmodel_medium=no])
+CFLAGS="$save_CFLAGS"
 dnl Whether we can test -mcmodel=medium.
 AM_CONDITIONAL(MCMODEL_MEDIUM,
-[test "$target_cpu" = "x86_64" -a "$gold_cv_prog_gcc41" = "yes"])
+[test "$target_cpu" = "x86_64" -a "$have_mcmodel_medium" = "yes" -a "$gold_cv_prog_gcc41" = "yes"])
 
 dnl Test for __thread support.
 AC_CACHE_CHECK([for thread support], [gold_cv_c_thread],