From 6d6a648c0789fb227ee2adfb089fe0ce8174708d Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Tue, 3 May 2016 23:47:55 +0100 Subject: [PATCH] PR 10549: MIPS/LD: Handle OSABI setting for STB_GNU_UNIQUE Add missing OSABI handling for MIPS/LD, complementing: commit f64b2e8d60f277b705c96d4b4e585f5f7c847cc4 Author: Nick Clifton Date: Mon Apr 11 08:13:22 2011 +0000 Adjust test coverage accordingly. bfd/ PR 10549 * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Handle STB_GNU_UNIQUE. ld/ PR 10549 * testsuite/ld-unique/unique.exp: Also run for `mips*-*-*'. --- bfd/ChangeLog | 6 ++++++ bfd/elfxx-mips.c | 5 +++++ ld/ChangeLog | 5 +++++ ld/testsuite/ld-unique/unique.exp | 3 ++- 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 432ec91..41feb85 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2016-05-03 Maciej W. Rozycki + + PR 10549 + * elfxx-mips.c (_bfd_mips_elf_add_symbol_hook): Handle + STB_GNU_UNIQUE. + 2016-05-03 Jiong Wang * bfd-in.h (bfd_elf64_aarch64_set_options): Update prototype. diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index a46b2f5..3c2de4e 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -7526,6 +7526,11 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, mips_elf_hash_table (info)->rld_symbol = h; } + if (ELF_ST_BIND (sym->st_info) == STB_GNU_UNIQUE + && (abfd->flags & DYNAMIC) == 0 + && bfd_get_flavour (info->output_bfd) == bfd_target_elf_flavour) + elf_tdata (info->output_bfd)->has_gnu_symbols |= elf_gnu_symbol_unique; + /* If this is a mips16 text symbol, add 1 to the value to make it odd. This will cause something like .word SYM to come up with the right value when it is loaded into the PC. */ diff --git a/ld/ChangeLog b/ld/ChangeLog index 7d8d8ee..092d2e8 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2016-05-03 Maciej W. Rozycki + + PR 10549 + * testsuite/ld-unique/unique.exp: Also run for `mips*-*-*'. + 2016-05-03 Jiong Wang * emultempl/aarch64elf.em (--no-apply-dynamic-relocs): New option. diff --git a/ld/testsuite/ld-unique/unique.exp b/ld/testsuite/ld-unique/unique.exp index 1892740..c632a92 100644 --- a/ld/testsuite/ld-unique/unique.exp +++ b/ld/testsuite/ld-unique/unique.exp @@ -25,10 +25,11 @@ # STB_GNU_UNIQUE support has only been implemented for the ix86, x86_64, -# arm, powerpc, and sparc so far. +# arm, mips, powerpc, and sparc so far. if {!(([istarget "i?86-*-*"] || [istarget "x86_64-*-*"] || [istarget "arm*-*-*"] + || [istarget "mips*-*-*"] || [istarget "powerpc*-*-*"] || [istarget "sparc*-*-*"]) && ([istarget "*-*-elf*"] -- 2.7.4