install.texi (Configuration): Document --with-linker-hash-style.
authorSatoru Takabayashi <satorux@google.com>
Wed, 11 May 2011 18:28:14 +0000 (18:28 +0000)
committerPaul Pluzhnikov <ppluzhnikov@gcc.gnu.org>
Wed, 11 May 2011 18:28:14 +0000 (11:28 -0700)
2011-05-11  Satoru Takabayashi  <satorux@google.com>
    Paul Pluzhnikov  <ppluzhnikov@google.com>

* gcc/doc/install.texi (Configuration): Document
--with-linker-hash-style.
* gcc/gcc.c (init_spec): Handle LINKER_HASH_STYLE.
* gcc/config.in: Add LINKER_HASH_STYLE.
* gcc/configure.ac: Add --with-linker-hash-style.
* gcc/configure: Regenerate.

Co-Authored-By: Paul Pluzhnikov <ppluzhnikov@google.com>
From-SVN: r173668

gcc/ChangeLog
gcc/config.in
gcc/configure
gcc/configure.ac
gcc/doc/install.texi
gcc/gcc.c

index 7ab7fb83759d1d6ef90386560894e3a1dad94583..fae9956804e55ae33bb31389fd9f9329e3e4d603 100644 (file)
@@ -1,3 +1,13 @@
+2011-05-11  Satoru Takabayashi  <satorux@google.com>
+           Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+       * gcc/doc/install.texi (Configuration): Document
+       --with-linker-hash-style.
+       * gcc/gcc.c (init_spec): Handle LINKER_HASH_STYLE.
+       * gcc/config.in: Add LINKER_HASH_STYLE.
+       * gcc/configure.ac: Add --with-linker-hash-style.
+       * gcc/configure: Regenerate.
+
 2011-05-11  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/48964
index f4885ca8374b5eada08caa418a96d9d8af8844e8..43aa919e669b9dfa6d77924489ad1c5388e98608 100644 (file)
 #endif
 
 
+/* The linker hash style */
+#ifndef USED_FOR_TARGET
+#undef LINKER_HASH_STYLE
+#endif
+
+
 /* Define to the name of the LTO plugin DSO that must be passed to the
    linker's -plugin=LIB option. */
 #ifndef USED_FOR_TARGET
index fe21f86fe329d098758bd386cf157e2c17287a98..9317601817438a31cc3cb573bc17833a17448d51 100755 (executable)
@@ -915,6 +915,7 @@ enable_version_specific_runtime_libs
 with_slibdir
 enable_plugin
 enable_libquadmath_support
+with_linker_hash_style
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1665,6 +1666,8 @@ Optional Packages:
                           with the compiler
   --with-system-zlib      use installed libz
   --with-slibdir=DIR      shared libraries in DIR [LIBDIR]
+  --with-linker-hash-style={sysv,gnu,both}
+                          specify the linker hash style
 
 Some influential environment variables:
   CC          C compiler command
@@ -17514,7 +17517,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17517 "configure"
+#line 17520 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17620,7 +17623,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17623 "configure"
+#line 17626 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -26469,6 +26472,36 @@ $as_echo "#define ENABLE_LIBQUADMATH_SUPPORT 1" >>confdefs.h
 fi
 
 
+# Specify what hash style to use by default.
+
+# Check whether --with-linker-hash-style was given.
+if test "${with_linker_hash_style+set}" = set; then :
+  withval=$with_linker_hash_style; case x"$withval" in
+   xsysv)
+     LINKER_HASH_STYLE=sysv
+     ;;
+   xgnu)
+     LINKER_HASH_STYLE=gnu
+     ;;
+   xboth)
+     LINKER_HASH_STYLE=both
+     ;;
+   *)
+     as_fn_error "$withval is an invalid option to --with-linker-hash-style" "$LINENO" 5
+     ;;
+ esac
+else
+  LINKER_HASH_STYLE=''
+fi
+
+if test x"${LINKER_HASH_STYLE}" != x; then
+
+cat >>confdefs.h <<_ACEOF
+#define LINKER_HASH_STYLE "$LINKER_HASH_STYLE"
+_ACEOF
+
+fi
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
index 3f51efd36173f89a3cf6cead2a1855406b96f114..92d9e2950866e89e07218b6a7f77348c476f7411 100644 (file)
@@ -4942,6 +4942,30 @@ if test "${ENABLE_LIBQUADMATH_SUPPORT}" != "no" ; then
 fi
 
 
+# Specify what hash style to use by default.
+AC_ARG_WITH([linker-hash-style],
+[AC_HELP_STRING([--with-linker-hash-style={sysv,gnu,both}],
+                [specify the linker hash style])],
+[case x"$withval" in
+   xsysv)
+     LINKER_HASH_STYLE=sysv
+     ;;
+   xgnu)
+     LINKER_HASH_STYLE=gnu
+     ;;
+   xboth)
+     LINKER_HASH_STYLE=both
+     ;;
+   *)
+     AC_MSG_ERROR([$withval is an invalid option to --with-linker-hash-style])
+     ;;
+ esac],
+[LINKER_HASH_STYLE=''])
+if test x"${LINKER_HASH_STYLE}" != x; then
+  AC_DEFINE_UNQUOTED(LINKER_HASH_STYLE, "$LINKER_HASH_STYLE",
+                                         [The linker hash style])
+fi
+
 # Configure the subdirectories
 # AC_CONFIG_SUBDIRS($subdirs)
 
index c19cbf9d47c5bfb34670da85496bf24cbbb97b75..904b805dc6182f591a5531bd479d0840344a1ba4 100644 (file)
@@ -1659,6 +1659,11 @@ option), if the linker supports it.  If you specify
 support @option{--build-id} option, a warning is issued and the
 @option{--enable-linker-build-id} option is ignored.  The default is off.
 
+@item --with-linker-hash-style=@var{choice}
+Tells GCC to pass @option{--hash-style=@var{choice}} option to the
+linker for all final links. @var{choice} can be one of
+@samp{sysv}, @samp{gnu}, and @samp{both} where @samp{sysv} is the default.
+
 @item --enable-gnu-unique-object
 @itemx --disable-gnu-unique-object
 Tells GCC to use the gnu_unique_object relocation for C++ template
index f9a2bb2105c94957a4f6e6ccb852ea9b129992ea..c43e45ab427add091f0917cdb39cd05c4a0c9a5f 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1438,7 +1438,8 @@ init_spec (void)
   }
 #endif
 
-#if defined LINK_EH_SPEC || defined LINK_BUILDID_SPEC
+#if defined LINK_EH_SPEC || defined LINK_BUILDID_SPEC || \
+    defined LINKER_HASH_STYLE
 # ifdef LINK_BUILDID_SPEC
   /* Prepend LINK_BUILDID_SPEC to whatever link_spec we had before.  */
   obstack_grow (&obstack, LINK_BUILDID_SPEC, sizeof(LINK_BUILDID_SPEC) - 1);
@@ -1446,6 +1447,16 @@ init_spec (void)
 # ifdef LINK_EH_SPEC
   /* Prepend LINK_EH_SPEC to whatever link_spec we had before.  */
   obstack_grow (&obstack, LINK_EH_SPEC, sizeof(LINK_EH_SPEC) - 1);
+# endif
+# ifdef LINKER_HASH_STYLE
+  /* Prepend --hash-style=LINKER_HASH_STYLE to whatever link_spec we had
+     before.  */
+  {
+    static const char hash_style[] = "--hash-style=";
+    obstack_grow (&obstack, hash_style, sizeof(hash_style) - 1);
+    obstack_grow (&obstack, LINKER_HASH_STYLE, sizeof(LINKER_HASH_STYLE) - 1);
+    obstack_1grow (&obstack, ' ');
+  }
 # endif
   obstack_grow0 (&obstack, link_spec, strlen (link_spec));
   link_spec = XOBFINISH (&obstack, const char *);