This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] bfd: blackfin: fix hidden symbol recording
- From: Mike Frysinger <vapier at gentoo dot org>
- To: binutils at sourceware dot org
- Cc: Bernd Schmidt <bernds_cb1 at t-online dot de>
- Date: Tue, 21 Sep 2010 05:42:56 -0400
- Subject: [PATCH] bfd: blackfin: fix hidden symbol recording
From: Bernd Schmidt <bernds_cb1@t-online.de>
Depending on the order of objects the linker sees, hidden symbols are not
always culled properly for Blackfin targets. So make sure we only output
them when necessary and not when we happen to see them relative to other
symbols.
Signed-off-by: Bernd Schmidt <bernds_cb1@t-online.de>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-09-21 Bernd Schmidt <bernds_cb1@t-online.de>
* elf32-bfin.c (_bfinfdpic_count_nontls_entries): Call
bfd_elf_link_record_dynamic_symbol here, if necessary, rather than...
(bfinfdpic_check_relocs): ... here.
---
bfd/elf32-bfin.c | 25 +++++++++++++------------
1 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index ac41d63..e329f43 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -3582,6 +3582,8 @@ static void
_bfinfdpic_count_nontls_entries (struct bfinfdpic_relocs_info *entry,
struct _bfinfdpic_dynamic_got_info *dinfo)
{
+ struct elf_link_hash_table *htab = elf_hash_table (dinfo->info);
+
/* Allocate space for a GOT entry pointing to the symbol. */
if (entry->got17m4)
dinfo->got17m4 += 4;
@@ -3601,11 +3603,20 @@ _bfinfdpic_count_nontls_entries (struct bfinfdpic_relocs_info *entry,
entry->relocsfd--;
entry->relocsfd++;
+ /* Make sure the symbol is output as a dynamic symbol if necessary. */
+ if (htab->dynamic_sections_created
+ && entry->symndx == -1 && entry->d.h->dynindx == -1
+ && (entry->relocs32 || entry->relocsfd || entry->call)
+ && !entry->d.h->forced_local)
+ {
+ bfd_elf_link_record_dynamic_symbol (dinfo->info, entry->d.h);
+ }
+
/* Decide whether we need a PLT entry, a function descriptor in the
GOT, and a lazy PLT entry for this symbol. */
entry->plt = entry->call
&& entry->symndx == -1 && ! BFINFDPIC_SYM_LOCAL (dinfo->info, entry->d.h)
- && elf_hash_table (dinfo->info)->dynamic_sections_created;
+ && htab->dynamic_sections_created;
entry->privfd = entry->plt
|| entry->fdgoff17m4 || entry->fdgoffhilo
|| ((entry->fd || entry->fdgot17m4 || entry->fdgothilo)
@@ -3614,7 +3625,7 @@ _bfinfdpic_count_nontls_entries (struct bfinfdpic_relocs_info *entry,
entry->lazyplt = entry->privfd
&& entry->symndx == -1 && ! BFINFDPIC_SYM_LOCAL (dinfo->info, entry->d.h)
&& ! (dinfo->info->flags & DF_BIND_NOW)
- && elf_hash_table (dinfo->info)->dynamic_sections_created;
+ && htab->dynamic_sections_created;
/* Allocate space for a function descriptor. */
if (entry->fdgoff17m4)
@@ -4854,16 +4865,6 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info,
}
if (h != NULL)
{
- if (h->dynindx == -1)
- switch (ELF_ST_VISIBILITY (h->other))
- {
- case STV_INTERNAL:
- case STV_HIDDEN:
- break;
- default:
- bfd_elf_link_record_dynamic_symbol (info, h);
- break;
- }
picrel
= bfinfdpic_relocs_info_for_global (bfinfdpic_relocs_info (info),
abfd, h,
--
1.7.2