This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2 v5] gold: enable new dtags by default


On Tue, Feb 5, 2013 at 8:46 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Feb 5, 2013 at 1:38 AM, Alan Modra <amodra@gmail.com> wrote:
>> On Mon, Feb 04, 2013 at 09:43:04PM -0800, Ian Lance Taylor wrote:
>>> It seems that we have made sensible-seeming decisions to wind up in an
>>> absurd place.
>>
>> Right, so where did we go wrong?  I think it was in assuming that we
>> could default to --enable-new-dtags.  Users were affected.  (I'm
>> assuming HJ's PR ld/15096 came from a real world problem.)
>>
>> I propose reverting HJ's patch, and Mike's and Roland's 2013-02-21
>> patches.  That will leave us with just Mike's 2013-01-18 change to
>> disable old dtags when new dtags are selected.  If people want new
>> dtags by default, do so via the gcc driver.
>>
>
> Or we can just revert my change and add --runpath.   -rpath will always
> generate DT_RPATH and --runpath will generate DT_RUNPATH.   What
> should happen when both -rpath and --runpath are on command line?
>
Something like this.   -runpath will enable DT_RUNPATH.  Also
-runpath=PATH can also be used to specify DT_RUNPATH.


-- 
H.J.
---
diff --git a/bfd/elflink.c b/bfd/elflink.c
index d336730..60cf76f 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -5737,7 +5737,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
 	  if (indx == (bfd_size_type) -1)
 	    return FALSE;

-	  tag = info->new_dtags ? DT_RUNPATH : DT_RPATH;
+	  tag = info->runpath ? DT_RUNPATH : DT_RPATH;
 	  if (!_bfd_elf_add_dynamic_entry (info, tag, indx))
 	    return FALSE;
 	}
diff --git a/include/bfdlink.h b/include/bfdlink.h
index bf44dee..9c6fcbd 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -368,6 +368,9 @@ struct bfd_link_info
   /* TRUE if the new ELF dynamic tags are enabled. */
   unsigned int new_dtags: 1;

+  /* TRUE if DT_RUNPATH instead of DT_RPATH should be generated. */
+  unsigned int runpath: 1;
+
   /* FALSE if .eh_frame unwind info should be generated for PLT and other
      linker created sections, TRUE if it should be omitted.  */
   unsigned int no_ld_generated_unwind_info: 1;
diff --git a/ld/ldlex.h b/ld/ldlex.h
index 99f4282..74cb774 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -56,6 +56,7 @@ enum option_values
   OPTION_RETAIN_SYMBOLS_FILE,
   OPTION_RPATH,
   OPTION_RPATH_LINK,
+  OPTION_RUNPATH,
   OPTION_SHARED,
   OPTION_SONAME,
   OPTION_SORT_COMMON,
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 2f71750..40a669b 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -395,10 +395,14 @@ static const struct ld_option ld_options[] =
      OPTION_RETAIN_SYMBOLS_FILE},
     '\0', N_("FILE"), N_("Keep only symbols listed in FILE"), TWO_DASHES },
   { {"rpath", required_argument, NULL, OPTION_RPATH},
-    '\0', N_("PATH"), N_("Set runtime shared library search path"), ONE_DASH },
+    '\0', N_("PATH"), N_("Set runtime shared library search path (DT_RPATH"),
+    ONE_DASH },
   { {"rpath-link", required_argument, NULL, OPTION_RPATH_LINK},
     '\0', N_("PATH"), N_("Set link time shared library search path"),
     ONE_DASH },
+  { {"runpath", optional_argument, NULL, OPTION_RUNPATH},
+    '\0', N_("PATH"), N_("Set runtime shared library search path (DT_RUNPATH"),
+    ONE_DASH },
   { {"shared", no_argument, NULL, OPTION_SHARED},
     '\0', NULL, N_("Create a shared library"), ONE_DASH },
   { {"Bshareable", no_argument, NULL, OPTION_SHARED }, /* FreeBSD.  */
@@ -990,6 +994,11 @@ parse_args (unsigned argc, char **argv)
 	  config.text_read_only = FALSE;
 	  input_flags.dynamic = FALSE;
 	  break;
+	case OPTION_RUNPATH:
+	  link_info.runpath = TRUE;
+	  if (optarg == NULL)
+	    break;
+	  goto handle_rpath;
 	case 'R':
 	  /* The GNU linker traditionally uses -R to mean to include
 	     only the symbols from a file.  The Solaris linker uses -R
@@ -1012,6 +1021,7 @@ parse_args (unsigned argc, char **argv)
 	  }
 	  /* Fall through.  */
 	case OPTION_RPATH:
+handle_rpath:
 	  if (command_line.rpath == NULL)
 	    command_line.rpath = xstrdup (optarg);
 	  else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]