Introduce --enable-new-dtags configure option.
authorSlava Barinov <v.barinov@samsung.com>
Thu, 25 May 2017 08:10:06 +0000 (11:10 +0300)
committerSlava Barinov <v.barinov@samsung.com>
Thu, 1 Jun 2017 12:19:26 +0000 (15:19 +0300)
ld/configure --enable-new-dtags sets ld.bfd --enable-new-dtags option by
default.

The ld option switches on generation of DT_RUNPATH tag instead of DT_RPATH tag
which is deprecated and breaks LD_LIBRARY_PATH usage.

Debian binutils bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835859

        * ld/configure.ac: Add --enable-new-dtags option.
        * ld/ldmain.c: Set link_info.new_dtags to 1 if when --enable-new-dtags is
          switched on.
        * ld/configure: Regenerate.
        * ld/config.in: Regenerate.
        * packaging/binutils.spec: Switch on --enable-new-dtags.
        * packaging/binutils-armv7l.spec: Regenerate.
        * packaging/binutils-aarch64.spec: Regenerate.

Change-Id: I0ec86f61a8b97d55c29bb441a9ae4db94060ea22
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
ld/config.in
ld/configure
ld/configure.ac
ld/ldmain.c
packaging/binutils-aarch64.spec
packaging/binutils-armv7l.spec
packaging/binutils.spec

index 2c6d698..5d91380 100644 (file)
 /* Define to 1 if you want to enable -z relro in ELF linker by default. */
 #undef DEFAULT_LD_Z_RELRO
 
+/* Define to 1 if you want to set DT_RUNPATH instead of DT_RPATH by default.
+   */
+#undef DEFAULT_NEW_DTAGS
+
 /* Define to 1 if translation of program messages to the user's native
    language is requested. */
 #undef ENABLE_NLS
index c6f871d..1cd12d3 100755 (executable)
@@ -791,6 +791,7 @@ with_sysroot
 enable_gold
 enable_got
 enable_compressed_debug_sections
+enable_new_dtags
 enable_relro
 enable_werror
 enable_build_warnings
@@ -1450,6 +1451,7 @@ Optional Features:
                           multigot)
   --enable-compressed-debug-sections={all,ld,none}
                           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-werror         treat compile warnings as errors
   --enable-build-warnings enable build-time compiler warnings
@@ -11723,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 11726 "configure"
+#line 11728 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11829,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 11832 "configure"
+#line 11834 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15543,6 +15545,17 @@ if test "${enable_compressed_debug_sections+set}" = set; then :
 esac
 fi
 
+# Decide setting DT_RUNPATH instead of DT_RPATH by default
+ac_default_new_dtags=unset
+# Provide a configure time option to override our default.
+# Check whether --enable-new_dtags was given.
+if test "${enable_new_dtags+set}" = set; then :
+  enableval=$enable_new_dtags; case "${enableval}" in
+  yes) ac_default_new_dtags=1 ;;
+  no) ac_default_new_dtags=0 ;;
+esac
+fi
+
 # Decide if -z relro should be enabled in ELF linker by default.
 ac_default_ld_z_relro=unset
 # Provide a configure time option to override our default.
@@ -17160,6 +17173,15 @@ $as_echo "#define DEFAULT_FLAG_COMPRESS_DEBUG 1" >>confdefs.h
 
 fi
 
+if test "${ac_default_new_dtags}" = unset; then
+  ac_default_new_dtags=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_NEW_DTAGS $ac_default_new_dtags
+_ACEOF
+
+
 if test "${ac_default_ld_z_relro}" = unset; then
   ac_default_ld_z_relro=0
 fi
index d17281f..dbf70c2 100644 (file)
@@ -155,6 +155,17 @@ AC_ARG_ENABLE(compressed_debug_sections,
   ,no, | ,none,)  ac_default_compressed_debug_sections=no ;;
 esac])dnl
 
+# Decide setting DT_RUNPATH instead of DT_RPATH by default
+ac_default_new_dtags=unset
+# Provide a configure time option to override our default.
+AC_ARG_ENABLE(new_dtags,
+             AS_HELP_STRING([--enable-new-dtags],
+             [set DT_RUNPATH instead of DT_RPATH by default])],
+[case "${enableval}" in
+  yes) ac_default_new_dtags=1 ;;
+  no) ac_default_new_dtags=0 ;;
+esac])dnl
+
 # Decide if -z relro should be enabled in ELF linker by default.
 ac_default_ld_z_relro=unset
 # Provide a configure time option to override our default.
@@ -387,6 +398,13 @@ if test x$ac_default_compressed_debug_sections = xyes ; then
   AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.])
 fi
 
+if test "${ac_default_new_dtags}" = unset; then
+  ac_default_new_dtags=0
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_NEW_DTAGS,
+  $ac_default_new_dtags,
+  [Define to 1 if you want to set DT_RUNPATH instead of DT_RPATH by default.])
+
 if test "${ac_default_ld_z_relro}" = unset; then
   ac_default_ld_z_relro=0
 fi
index e7a8dff..6a33431 100644 (file)
@@ -285,6 +285,9 @@ main (int argc, char **argv)
 #ifdef DEFAULT_FLAG_COMPRESS_DEBUG
   link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
 #endif
+#ifdef DEFAULT_NEW_DTAGS
+  link_info.new_dtags = TRUE;
+#endif
 
   ldfile_add_arch ("");
   emulation = get_emulation (argc, argv);
index 56dce89..ea628b8 100644 (file)
@@ -100,7 +100,8 @@ cd build-dir
 } \
        --enable-plugins \
        --enable-gold \
-       --enable-shared
+       --enable-shared \
+       --enable-new-dtags
 
 make %{?_smp_mflags}
 
index 4f94202..6ef2038 100644 (file)
@@ -100,7 +100,8 @@ cd build-dir
 } \
        --enable-plugins \
        --enable-gold \
-       --enable-shared
+       --enable-shared \
+       --enable-new-dtags
 
 make %{?_smp_mflags}
 
index cb05a89..b6826cc 100644 (file)
@@ -97,7 +97,8 @@ cd build-dir
 } \
        --enable-plugins \
        --enable-gold \
-       --enable-shared
+       --enable-shared \
+       --enable-new-dtags
 
 make %{?_smp_mflags}