]> 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>
Sat, 12 Nov 2016 07:33:31 +0000 (02:33 -0500)
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 860ac1056999701305fbccd7be455b9617cd7357..c4650a8ba3828555abaee4069b67c06393bd89d5 100644 (file)
@@ -856,7 +856,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 4a333d546c687ef107862272f575ea25b6575aea..359ce926d30c8967b5ec3bc5fd1c7e6fb73266a9 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 a9cd9f771d3d88bb3b63f918b4763fa997c61027..8bec8fc6433d2e0680a5c6439dc772cde92922e1 100644 (file)
@@ -144,7 +144,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
@@ -225,7 +225,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.