[RFC][PATCH v5 2/6] Handle -z unique/-z nounique in ld
Vivek Das Mohapatra
vivek@collabora.com
Fri Jul 10 16:01:29 GMT 2020
More information about the Binutils mailing list
Fri Jul 10 16:01:29 GMT 2020
- Previous message (by thread): [RFC][PATCH v5 1/6] Define a new DT_GNU_FLAGS_1 dynamic section for ld, readelf et al
- Next message (by thread): [RFC][PATCH v5 3/6] Document -z unique/-z nounique in the ld man page and help output
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Add (or suppress) a DT_GNU_FLAGS_1 dynamic section with a bit flag value of DF_GNU_1_UNIQUE. --- bfd/ChangeLog | 46 +++++----------------------------------------- bfd/elflink.c | 5 ++++- include/ChangeLog | 1 + include/bfdlink.h | 3 +++ ld/ChangeLog | 5 +++++ ld/emultempl/elf.em | 4 ++++ 6 files changed, 22 insertions(+), 42 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3cb4881feb..001b00e36e 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2020-07-10 Vivek Das Mohapatra <vivek@collabora.com> + + * elflink.c (bfd_elf_size_dynamic_sections): Call + _bfd_elf_add_dynamic_entry to add a DT_GNU_FLAGS_1 section. + 2020-07-10 Alan Modra <amodra@gmail.com> * elf64-ppc.h (struct ppc64_elf_params): Add power10_stubs. @@ -370,47 +375,6 @@ * elfxx-x86.h (elf_x86_link_hash_table): Remove readonly_dynrelocs_against_ifunc. -2020-06-09 Alan Modra <amodra@gmail.com> - - * elf64-ppc.c (struct ppc_link_hash_table): Delete - maybe_local_ifunc_resolver field. - (build_global_entry_stubs_and_plt): Set local_ifunc_resolver in - cases where maybe_local_ifunc_resolver was set. - (ppc64_elf_relocate_section): Likewise. - (ppc64_elf_finish_dynamic_sections): Downgrade ifunc with textrel - error to a warning. - -2020-06-08 H.J. Lu <hongjiu.lu@intel.com> - - * elf-bfd.h (elf_link_hash_entry): Add tlsdesc_plt and - tlsdesc_got. - * elf32-arm.c (elf32_arm_link_hash_table): Remove tlsdesc_plt - and dt_tlsdesc_got. - (elf32_arm_size_dynamic_sections): Updated. Clear - root.tlsdesc_plt for DF_BIND_NOW. - (elf32_arm_finish_dynamic_sections): Updated. - (elf32_arm_output_arch_local_syms): Likewise. - * elf32-nds32.c (nds32_elf_size_dynamic_sections): Updated. - Clear root.tlsdesc_plt for DF_BIND_NOW. - (nds32_elf_finish_dynamic_sections): Updated. - * elf32-nds32.h (elf_nds32_link_hash_table): Remove - dt_tlsdesc_plt and dt_tlsdesc_got. - * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Updated. - * elfnn-aarch64.c (elf_aarch64_link_hash_table): Remove - tlsdesc_plt and dt_tlsdesc_got. - (elfNN_aarch64_allocate_dynrelocs): Updated. - (elfNN_aarch64_finish_dynamic_sections): Likewise. - (elfNN_aarch64_size_dynamic_sections): Updated. Clear - root.tlsdesc_plt for DF_BIND_NOW. Don't check DF_BIND_NOW - twice. - * elfxx-x86.c (elf_x86_allocate_dynrelocs): Updated. - (_bfd_x86_elf_size_dynamic_sections): Likewise. - (_bfd_x86_elf_finish_dynamic_sections): Likewise. - * elfxx-x86.h (elf_x86_link_hash_table): Remove tlsdesc_plt and - tlsdesc_got. - -2020-06-07 H.J. Lu <hongjiu.lu@intel.com> - * elf32-tic6x.c (elf32_bed): Defined the default to elf32_tic6x_bed. diff --git a/bfd/elflink.c b/bfd/elflink.c index 998b72f228..be6ba056f4 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -7132,7 +7132,10 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, || !_bfd_elf_add_dynamic_entry (info, DT_SYMTAB, 0) || !_bfd_elf_add_dynamic_entry (info, DT_STRSZ, strsize) || !_bfd_elf_add_dynamic_entry (info, DT_SYMENT, - bed->s->sizeof_sym)) + bed->s->sizeof_sym) + || (info->gnu_flags_1 + && !_bfd_elf_add_dynamic_entry (info, DT_GNU_FLAGS_1, + info->gnu_flags_1))) return FALSE; } } diff --git a/include/ChangeLog b/include/ChangeLog index c0303f0e6d..d5615db4b1 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,6 +1,7 @@ 2020-07-10 Vivek Das Mohapatra <vivek@collabora.com> * elf/common.h (DT_GNU_FLAGS_1, DF_GNU_1_UNIQUE): Define. + * bfdlink.h (struct bfd_link_info): New field gnu_flags_1. 2020-07-09 John Baldwin <jhb@FreeBSD.org> diff --git a/include/bfdlink.h b/include/bfdlink.h index 7163433383..e66c324040 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -649,6 +649,9 @@ struct bfd_link_info /* May be used to set DT_FLAGS_1 for ELF. */ bfd_vma flags_1; + /* May be used to set DT_GNU_FLAGS_1 for ELF. */ + bfd_vma gnu_flags_1; + /* May be used to set ELF visibility for __start_* / __stop_. */ unsigned int start_stop_visibility; diff --git a/ld/ChangeLog b/ld/ChangeLog index c0bbaf95df..b10c354776 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2020-07-10 Vivek Das Mohapatra <vivek@collabora.com> + + * emultempl/elf.em (gld${EMULATION_NAME}_handle_option): + Parse -z unique / -z nounique options. + 2020-07-10 Alan Modra <amodra@gmail.com> * ld.texi (PowerPC64 ELF64): Document --no-inline-optimize, diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em index 356f34538b..32e8754ab7 100644 --- a/ld/emultempl/elf.em +++ b/ld/emultempl/elf.em @@ -805,6 +805,10 @@ fragment <<EOF link_info.flags |= (bfd_vma) DF_ORIGIN; link_info.flags_1 |= (bfd_vma) DF_1_ORIGIN; } + else if (strcmp (optarg, "unique") == 0) + link_info.gnu_flags_1 |= (bfd_vma) DF_GNU_1_UNIQUE; + else if (strcmp (optarg, "nounique") == 0) + link_info.gnu_flags_1 &= ~(bfd_vma) DF_GNU_1_UNIQUE; else if (strcmp (optarg, "combreloc") == 0) link_info.combreloc = TRUE; else if (strcmp (optarg, "nocombreloc") == 0) -- 2.11.0
- Previous message (by thread): [RFC][PATCH v5 1/6] Define a new DT_GNU_FLAGS_1 dynamic section for ld, readelf et al
- Next message (by thread): [RFC][PATCH v5 3/6] Document -z unique/-z nounique in the ld man page and help output
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list