]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gold/ld: enable gnu hash by default
authorMike Frysinger <vapier@gentoo.org>
Sat, 27 Jan 2007 20:01:08 +0000 (15:01 -0500)
committerMike Frysinger <vapier@gentoo.org>
Fri, 3 Mar 2017 18:03:21 +0000 (11:03 -0700)
Glibc first added .gnu.hash support to glibc-2.5 (released 29 Sep 2006),
and gold was first released after that.  Let's default the gnu hash style
to the new "gnu" rather than the classic sysv.

gold/:
2012-02-03  Mike Frysinger  <vapier@gentoo.org>

* options.h (General_options): Change default to gnu for hash_style.

gold/options.h
ld/emultempl/elf32.em
ld/testsuite/lib/ld-lib.exp

index b7c725a82539dda5960c3a6b03b526aea452192b..ef17566712429998990163698819e5a31d675d6a 100644 (file)
@@ -921,7 +921,7 @@ class General_options
                N_("Min fraction of empty buckets in dynamic hash"),
                N_("FRACTION"));
 
-  DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "sysv",
+  DEFINE_enum(hash_style, options::TWO_DASHES, '\0', "gnu",
              N_("Dynamic hash style"), N_("[sysv,gnu,both]"),
              {"sysv", "gnu", "both"});
 
index 92b7e4aabd0b214c563191be6450cf21dc730e90..ac2090a54eb1b5501cdd4d6a39905172d46cad43 100644 (file)
@@ -100,6 +100,19 @@ static void
 gld${EMULATION_NAME}_before_parse (void)
 {
   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
+EOF
+# Enable gnu hash by default for Linux (non-mips) targets.
+# This has been supported since glibc-2.5.
+case ${target} in
+  mips*) ;;
+  *-*-linux-* | *-*-gnu*)
+    fragment <<EOF
+  link_info.emit_hash = FALSE;
+  link_info.emit_gnu_hash = TRUE;
+EOF
+    ;;
+esac
+fragment <<EOF
   input_flags.dynamic = ${DYNAMIC_LINK-TRUE};
   config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`;
   config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`;
index 6c6a0b7a001e4c03247a40b22f754b031080b967..53ad4a15e9832715d2ed52a6b2ac76b6d41bed4d 100644 (file)
@@ -147,7 +147,7 @@ proc default_ld_relocate { ld target objects } {
     global HOSTING_EMU
 
     remote_file host delete $target
-    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"]
+    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv -o $target -r $objects"]
 }
 
 # Check to see if ld is being invoked with a non-endian output format
@@ -228,7 +228,7 @@ proc default_ld_link { ld target objects } {
 
     remote_file host delete $target
 
-    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU $flags -o $target $objs $libs"]
+    return [run_host_cmd_yesno "$ld" "$HOSTING_EMU --hash-style=sysv $flags -o $target $objs $libs"]
 }
 
 # Link a program using ld, without including any libraries.