From b1b00fcc619cfa409c4e244f609ab82f3a3c37d2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 18 Jan 2013 17:43:58 +0000 Subject: [PATCH] ld: change --enable-new-dtags to only generate new dtags The "new" dtags options have been around for 14+ years, so there shouldn't be a need to generate both new & old tags anymore. Signed-off-by: Mike Frysinger --- bfd/ChangeLog | 6 ++++++ bfd/elflink.c | 13 +++++-------- gold/ChangeLog | 6 ++++++ gold/layout.cc | 5 +++-- ld/ChangeLog | 5 +++++ ld/NEWS | 2 ++ ld/ld.texinfo | 3 ++- 7 files changed, 29 insertions(+), 11 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 30fead2..85b411a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2013-01-18 Mike Frysinger + + * elflink.c (bfd_elf_size_dynamic_sections): Only add DT_RPATH + when new_dtags is false. Only add DT_RUNPATH when new_dtags is + true. + 2013-01-17 H.J. Lu * elf32-i386.c (elf_i386_check_relocs): Count size relocation as diff --git a/bfd/elflink.c b/bfd/elflink.c index 6985786..d336730 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -5730,19 +5730,16 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, if (rpath != NULL) { bfd_size_type indx; + bfd_vma tag; indx = _bfd_elf_strtab_add (elf_hash_table (info)->dynstr, rpath, TRUE); - if (indx == (bfd_size_type) -1 - || !_bfd_elf_add_dynamic_entry (info, DT_RPATH, indx)) + if (indx == (bfd_size_type) -1) return FALSE; - if (info->new_dtags) - { - _bfd_elf_strtab_addref (elf_hash_table (info)->dynstr, indx); - if (!_bfd_elf_add_dynamic_entry (info, DT_RUNPATH, indx)) - return FALSE; - } + tag = info->new_dtags ? DT_RUNPATH : DT_RPATH; + if (!_bfd_elf_add_dynamic_entry (info, tag, indx)) + return FALSE; } if (filter_shlib != NULL) diff --git a/gold/ChangeLog b/gold/ChangeLog index 01058c1..42d2d03 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,9 @@ +2013-01-18 Mike Frysinger + + * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH + when enable_new_dtags is false. Only add DT_RUNPATH when + enable_new_dtags is true. + 2013-01-17 Serge Pavlov * powerpc.cc (Stub_table::find_plt_call_entry): Make types diff --git a/gold/layout.cc b/gold/layout.cc index 576d44b..250782a 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -4647,8 +4647,9 @@ Layout::finish_dynamic_section(const Input_objects* input_objects, } } - odyn->add_string(elfcpp::DT_RPATH, rpath_val); - if (parameters->options().enable_new_dtags()) + if (!parameters->options().enable_new_dtags()) + odyn->add_string(elfcpp::DT_RPATH, rpath_val); + else odyn->add_string(elfcpp::DT_RUNPATH, rpath_val); } diff --git a/ld/ChangeLog b/ld/ChangeLog index cfbe799..190e081 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2013-01-18 Mike Frysinger + + * NEWS: Mention change in behavior with --enable-new-dtags. + * ld.texinfo (Options): Clarify --enable-new-dtags behavior. + 2013-01-14 Leif Ekblad Alan Modra diff --git a/ld/NEWS b/ld/NEWS index 9b9f4a6..1e07605 100644 --- a/ld/NEWS +++ b/ld/NEWS @@ -2,6 +2,8 @@ * Add support for the Imagination Technologies Meta processor. +* --enable-new-dtags no longer generates old dtags in addition to new dtags. + Changes in 2.23: * Enable compressed debug section feature for x86/x86_64 pe-coff. diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 2429668..194f56a 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -2112,7 +2112,8 @@ if linker generated unwind info is supported. @itemx --disable-new-dtags This linker can create the new dynamic tags in ELF. But the older ELF systems may not understand them. If you specify -@option{--enable-new-dtags}, the dynamic tags will be created as needed. +@option{--enable-new-dtags}, the new dynamic tags will be created as needed +and older dynamic tags will be omitted. If you specify @option{--disable-new-dtags}, no new dynamic tags will be created. By default, the new dynamic tags are not created. Note that those options are only available for ELF systems. -- 2.7.4