Add configure flag to enable gnu hash style by default.
authorRomain Geissler <romain.geissler@gmail.com>
Mon, 7 Aug 2017 21:55:39 +0000 (07:25 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 7 Aug 2017 21:55:39 +0000 (07:25 +0930)
ld/
* configure.ac: Add --enable-default-hash-style option.
* ldmain.c (main): Set link_info.emit_hash to DEFAULT_EMIT_SYSV_HASH.
Set link_info.emit_gnu_hash to DEFAULT_EMIT_GNU_HASH.
* configure: Regenerate.
* config.in: Regenerate.

gold/
* configure.ac: Add --enable-default-hash-style option.
* options.h (hash_style): Use DEFAULT_HASH_STYLE as default value.
* configure: Regenerate.
* config.in: Regenerate.

gold/ChangeLog
gold/config.in
gold/configure
gold/configure.ac
gold/options.h
ld/ChangeLog
ld/config.in
ld/configure
ld/configure.ac
ld/ldmain.c

index 950be7013a8e7e2a91b27095bb75bb04c91bee2c..813b27f716fdf40e05467af13f7fbe8d6923996e 100644 (file)
@@ -1,3 +1,11 @@
+2017-08-08  Romain Geissler  <romain.geissler@gmail.com>
+           Alan Modra  <amodra@gmail.com>
+
+       * configure.ac: Add --enable-default-hash-style option.
+       * options.h (hash_style): Use DEFAULT_HASH_STYLE as default value.
+       * configure: Regenerate.
+       * config.in: Regenerate.
+
 2017-08-03  James Clarke  <jrtc27@jrtc27.com>
 
        * options.h (General_options): Set a non-NULL second help string
index d9f7b76f29a5561b30342627f455252814626c41..5855fcac94c2528194f2dde602b546d1eb34a3ca 100644 (file)
@@ -10,6 +10,9 @@
 /* Define if building universal (internal helper macro) */
 #undef AC_APPLE_UNIVERSAL_BUILD
 
+/* Set the default --hash-style value */
+#undef DEFAULT_HASH_STYLE
+
 /* Define to 1 if you want to enable -z relro in ELF linker by default. */
 #undef DEFAULT_LD_Z_RELRO
 
index cb020be5fcbfd163abf4ee2f48a5d682ad11f412..90a706dc51ad012e29cbf12513f6d7f0322783e3 100755 (executable)
@@ -797,6 +797,7 @@ enable_threads
 enable_plugins
 enable_relro
 enable_targets
+enable_default_hash_style
 with_lib_path
 enable_dependency_tracking
 enable_nls
@@ -1447,6 +1448,8 @@ Optional Features:
   --enable-plugins        linker plugins
   --enable-relro          enable -z relro in ELF linker by default
   --enable-targets        alternative target configurations
+  --enable-default-hash-style={sysv,gnu,both}
+                          use this default hash style
   --disable-dependency-tracking  speeds up one-time build
   --enable-dependency-tracking   do not reject slow dependency extractors
   --disable-nls           do not use Native Language Support
@@ -3410,6 +3413,30 @@ if test -n "$enable_targets"; then
   done
 fi
 
+# Decide which "--hash-style" to use by default
+# Provide a configure time option to override our default.
+# Check whether --enable-default-hash-style was given.
+if test "${enable_default_hash_style+set}" = set; then :
+  enableval=$enable_default_hash_style; case "${enable_default_hash_style}" in
+  sysv | gnu | both) ;;
+  *) as_fn_error "bad value ${enable_default_hash_style} for enable-default-hash-style option" "$LINENO" 5 ;;
+esac
+else
+  case "${target}" in
+  # Enable gnu hash only on GNU targets, but not mips
+  mips*-*-*) enable_default_hash_style=sysv ;;
+  *-*-gnu* | *-*-linux* | *-*-nacl*) enable_default_hash_style=both ;;
+  *) enable_default_hash_style=sysv ;;
+esac
+fi
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_HASH_STYLE "${enable_default_hash_style}"
+_ACEOF
+
+
 # See which specific instantiations we need.
 targetobjs=
 all_targets=
index cbe338042309b40540419fc4990181c2935ebb13..d7fa1f88e8bdae617f04eeee76dd6f1ad9ec8d84 100644 (file)
@@ -161,6 +161,26 @@ if test -n "$enable_targets"; then
   done
 fi
 
+# Decide which "--hash-style" to use by default
+# Provide a configure time option to override our default.
+AC_ARG_ENABLE([default-hash-style],
+AS_HELP_STRING([--enable-default-hash-style={sysv,gnu,both}],
+              [use this default hash style]),
+[case "${enable_default_hash_style}" in
+  sysv | gnu | both) ;;
+  *) AC_MSG_ERROR([bad value ${enable_default_hash_style} for enable-default-hash-style option]) ;;
+esac],
+[case "${target}" in
+  # Enable gnu hash only on GNU targets, but not mips
+  mips*-*-*) enable_default_hash_style=sysv ;;
+  *-*-gnu* | *-*-linux* | *-*-nacl*) enable_default_hash_style=both ;;
+  *) enable_default_hash_style=sysv ;;
+esac])
+
+AC_DEFINE_UNQUOTED([DEFAULT_HASH_STYLE],
+  ["${enable_default_hash_style}"],
+  [Set the default --hash-style value])
+
 # See which specific instantiations we need.
 targetobjs=
 all_targets=
index 6b45f645e442d085ac9f850a3ef86f5814320e22..970e76f4d55b74a747f12ba785574175ef2a7dce 100644 (file)
@@ -925,7 +925,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', DEFAULT_HASH_STYLE,
              N_("Dynamic hash style"), N_("[sysv,gnu,both]"),
              {"sysv", "gnu", "both"});
 
index 9af0eeb949ef7e6477a8b9335eae842df282ea2e..645c0fe636cfb45646b824936a6ec6145a235027 100644 (file)
@@ -1,3 +1,12 @@
+2017-08-08  Romain Geissler  <romain.geissler@gmail.com>
+           Alan Modra  <amodra@gmail.com>
+
+       * configure.ac: Add --enable-default-hash-style option.
+       * ldmain.c (main): Set link_info.emit_hash to DEFAULT_EMIT_SYSV_HASH.
+       Set link_info.emit_gnu_hash to DEFAULT_EMIT_GNU_HASH.
+       * configure: Regenerate.
+       * config.in: Regenerate.
+
 2017-08-08  Alan Modra  <amodra@gmail.com>
 
        * testsuite/ld-aarch64/ifunc-1-local.d: Run ld with --hash-style=sysv.
index 5d91380ec2ad6dbc7e76daa54c7266d1ca8294c3..a846743da6b9989c875403554bbe3a3425a636b4 100644 (file)
@@ -7,6 +7,12 @@
 #endif
 #define __CONFIG_H__ 1
 
+/* Define to 1 if you want to emit gnu hash in the ELF linker by default. */
+#undef DEFAULT_EMIT_GNU_HASH
+
+/* Define to 1 if you want to emit sysv hash in the ELF linker by default. */
+#undef DEFAULT_EMIT_SYSV_HASH
+
 /* Define if you want compressed debug sections by default. */
 #undef DEFAULT_FLAG_COMPRESS_DEBUG
 
index 640902b85835e77a279a24de7aa1642f465c26f0..de709d3a82c82b09e0c65daeaf82ee9d09eaf240 100755 (executable)
@@ -790,6 +790,7 @@ enable_got
 enable_compressed_debug_sections
 enable_new_dtags
 enable_relro
+enable_default_hash_style
 enable_werror
 enable_build_warnings
 enable_nls
@@ -1450,6 +1451,8 @@ Optional Features:
                           compress debug sections by default]
   --enable-new-dtags      set DT_RUNPATH instead of DT_RPATH by default]
   --enable-relro          enable -z relro in ELF linker by default
+  --enable-default-hash-style={sysv,gnu,both}
+                          use this default hash style
   --enable-werror         treat compile warnings as errors
   --enable-build-warnings enable build-time compiler warnings
   --disable-nls           do not use Native Language Support
@@ -11722,7 +11725,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11725 "configure"
+#line 11728 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11828,7 +11831,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11831 "configure"
+#line 11834 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15564,6 +15567,34 @@ if test "${enable_relro+set}" = set; then :
 esac
 fi
 
+# Decide which "--hash-style" to use by default
+# Provide a configure time option to override our default.
+# Check whether --enable-default-hash-style was given.
+if test "${enable_default_hash_style+set}" = set; then :
+  enableval=$enable_default_hash_style; case "${enable_default_hash_style}" in
+  sysv | gnu | both) ;;
+  *) as_fn_error "bad value ${enable_default_hash_style} for enable-default-hash-style option" "$LINENO" 5 ;;
+esac
+else
+  case "${target}" in
+  # Enable gnu hash only on GNU targets, but not mips
+  mips*-*-*) enable_default_hash_style=sysv ;;
+  *-*-gnu* | *-*-linux* | *-*-nacl*) enable_default_hash_style=both ;;
+  *) enable_default_hash_style=sysv ;;
+esac
+fi
+
+
+case "${enable_default_hash_style}" in
+  sysv | both) ac_default_emit_sysv_hash=1 ;;
+  *) ac_default_emit_sysv_hash=0 ;;
+esac
+
+case "${enable_default_hash_style}" in
+  gnu | both) ac_default_emit_gnu_hash=1 ;;
+  *) ac_default_emit_gnu_hash=0 ;;
+esac
+
 
 # Set the 'development' global.
 . $srcdir/../bfd/development.sh
@@ -17228,6 +17259,18 @@ _ACEOF
 
 
 
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_EMIT_SYSV_HASH $ac_default_emit_sysv_hash
+_ACEOF
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_EMIT_GNU_HASH $ac_default_emit_gnu_hash
+_ACEOF
+
+
+
 
 
 
index ffe80185b10b495da4e6e0044654df0aeed2639f..99d127bd11b367721478158a5f22f470f20fdbcd 100644 (file)
@@ -177,6 +177,32 @@ AC_ARG_ENABLE(relro,
   no)  ac_default_ld_z_relro=0 ;;
 esac])dnl
 
+# Decide which "--hash-style" to use by default
+# Provide a configure time option to override our default.
+AC_ARG_ENABLE([default-hash-style],
+AS_HELP_STRING([--enable-default-hash-style={sysv,gnu,both}],
+              [use this default hash style]),
+[case "${enable_default_hash_style}" in
+  sysv | gnu | both) ;;
+  *) AC_MSG_ERROR([bad value ${enable_default_hash_style} for enable-default-hash-style option]) ;;
+esac],
+[case "${target}" in
+  # Enable gnu hash only on GNU targets, but not mips
+  mips*-*-*) enable_default_hash_style=sysv ;;
+  *-*-gnu* | *-*-linux* | *-*-nacl*) enable_default_hash_style=both ;;
+  *) enable_default_hash_style=sysv ;;
+esac])
+
+case "${enable_default_hash_style}" in
+  sysv | both) ac_default_emit_sysv_hash=1 ;;
+  *) ac_default_emit_sysv_hash=0 ;;
+esac
+
+case "${enable_default_hash_style}" in
+  gnu | both) ac_default_emit_gnu_hash=1 ;;
+  *) ac_default_emit_gnu_hash=0 ;;
+esac
+
 AM_BINUTILS_WARNINGS
 
 AM_LC_MESSAGES
@@ -408,6 +434,14 @@ AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_RELRO,
   $ac_default_ld_z_relro,
   [Define to 1 if you want to enable -z relro in ELF linker by default.])
 
+AC_DEFINE_UNQUOTED([DEFAULT_EMIT_SYSV_HASH],
+  [$ac_default_emit_sysv_hash],
+  [Define to 1 if you want to emit sysv hash in the ELF linker by default.])
+
+AC_DEFINE_UNQUOTED([DEFAULT_EMIT_GNU_HASH],
+  [$ac_default_emit_gnu_hash],
+  [Define to 1 if you want to emit gnu hash in the ELF linker by default.])
+
 AC_SUBST(elf_list_options)
 AC_SUBST(elf_shlib_list_options)
 AC_SUBST(elf_plt_unwind_list_options)
index cb1e2d158b7e509435b186d3d189d3567edb8df3..2b09f2041307015d45bea83f2c43a85e6681aad9 100644 (file)
@@ -273,7 +273,8 @@ main (int argc, char **argv)
   link_info.keep_memory = TRUE;
   link_info.combreloc = TRUE;
   link_info.strip_discarded = TRUE;
-  link_info.emit_hash = TRUE;
+  link_info.emit_hash = DEFAULT_EMIT_SYSV_HASH;
+  link_info.emit_gnu_hash = DEFAULT_EMIT_GNU_HASH;
   link_info.callbacks = &link_callbacks;
   link_info.input_bfds_tail = &link_info.input_bfds;
   /* SVR4 linkers seem to set DT_INIT and DT_FINI based on magic _init
This page took 0.041927 seconds and 4 git commands to generate.