* elf-bfd.h (elf_backend_data <elf_backend_hide_symbol>): Add

boolean param.
	(_bfd_elf_link_hash_hide_symbol): Likewise.
	* elflink.h (elf_link_add_object_symbols): Adjust call to
	elf_backend_hide_symbol.
	(elf_fix_symbol_flags): Likewise.
	(elf_link_assign_sym_version): Likewise. Use bfd_malloc rather
	than bfd_alloc.
	* elf.c (_bfd_elf_link_hash_hide_symbol): Add "force_local" param.
	Set ELF_LINK_FORCED_LOCAL and call _bfd_elf_strtab_delref.
	* elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
	(clobber_millicode_symbols): Adjust to suit new hide_symbol.
	* elf32-cris.c (elf_cris_hide_symbol): Add "force_local" param
	and adjust to suit.
	* elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise, and call
	_bfd_elf_link_hash_hide_symbol rather than duplicating code.
	* elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.
This commit is contained in:
Alan Modra 2002-01-21 10:29:09 +00:00
parent 61d99182f0
commit e5094212df
8 changed files with 82 additions and 65 deletions

View file

@ -1,3 +1,23 @@
2002-01-21 Alan Modra <amodra@bigpond.net.au>
* elf-bfd.h (elf_backend_data <elf_backend_hide_symbol>): Add
boolean param.
(_bfd_elf_link_hash_hide_symbol): Likewise.
* elflink.h (elf_link_add_object_symbols): Adjust call to
elf_backend_hide_symbol.
(elf_fix_symbol_flags): Likewise.
(elf_link_assign_sym_version): Likewise. Use bfd_malloc rather
than bfd_alloc.
* elf.c (_bfd_elf_link_hash_hide_symbol): Add "force_local" param.
Set ELF_LINK_FORCED_LOCAL and call _bfd_elf_strtab_delref.
* elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
(clobber_millicode_symbols): Adjust to suit new hide_symbol.
* elf32-cris.c (elf_cris_hide_symbol): Add "force_local" param
and adjust to suit.
* elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise, and call
_bfd_elf_link_hash_hide_symbol rather than duplicating code.
* elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.
2002-01-18 Alan Modra <amodra@bigpond.net.au>
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Test for a

View file

@ -1,6 +1,6 @@
/* BFD back-end data structures for ELF files.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -693,7 +693,7 @@ struct elf_backend_data
/* Modify any information related to dynamic linking such that the
symbol is not exported. */
void (*elf_backend_hide_symbol)
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
/* Emit relocations. Overrides default routine for emitting relocs,
except during a relocatable link, or if all relocs are being emitted. */
@ -1197,7 +1197,7 @@ extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
extern void _bfd_elf_link_hash_copy_indirect
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
extern void _bfd_elf_link_hash_hide_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
extern boolean _bfd_elf_link_hash_table_init
PARAMS ((struct elf_link_hash_table *, bfd *,
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,

View file

@ -1286,14 +1286,23 @@ _bfd_elf_link_hash_copy_indirect (dir, ind)
}
void
_bfd_elf_link_hash_hide_symbol (info, h)
struct bfd_link_info *info ATTRIBUTE_UNUSED;
_bfd_elf_link_hash_hide_symbol (info, h, force_local)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
boolean force_local;
{
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
h->plt.offset = (bfd_vma) -1;
if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
h->dynindx = -1;
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
if (force_local)
{
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
if (h->dynindx != -1)
{
h->dynindx = -1;
_bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
h->dynstr_index);
}
}
}
/* Initialize an ELF linker hash table. */

View file

@ -1,5 +1,5 @@
/* CRIS-specific support for 32-bit ELF.
Copyright 2000, 2001 Free Software Foundation, Inc.
Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson, based on elf32-fr30.c
PIC and shlib bits based primarily on elf32-m68k.c and elf32-i386.c.
@ -90,7 +90,7 @@ static boolean elf_cris_finish_dynamic_symbol
static boolean elf_cris_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static void elf_cris_hide_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
static enum elf_reloc_type_class elf_cris_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
@ -2028,13 +2028,14 @@ elf_cris_try_fold_plt_to_got (h, p)
entry. */
static void
elf_cris_hide_symbol (info, h)
elf_cris_hide_symbol (info, h, force_local)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
boolean force_local;
{
elf_cris_adjust_gotplt_to_got ((struct elf_cris_link_hash_entry *) h, info);
_bfd_elf_link_hash_hide_symbol (info, h);
_bfd_elf_link_hash_hide_symbol (info, h, force_local);
}
/* Adjust a symbol defined by a dynamic object and referenced by a

View file

@ -1,6 +1,6 @@
/* BFD back-end for HP PA-RISC ELF files.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001
Free Software Foundation, Inc.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
2002 Free Software Foundation, Inc.
Original code by
Center for Software Science
@ -335,7 +335,7 @@ static boolean elf32_hppa_gc_sweep_hook
asection *, const Elf_Internal_Rela *));
static void elf32_hppa_hide_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
static boolean elf32_hppa_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
@ -1786,12 +1786,22 @@ elf32_hppa_gc_sweep_hook (abfd, info, sec, relocs)
plabels. */
static void
elf32_hppa_hide_symbol (info, h)
struct bfd_link_info *info ATTRIBUTE_UNUSED;
elf32_hppa_hide_symbol (info, h, force_local)
struct bfd_link_info *info;
struct elf_link_hash_entry *h;
boolean force_local;
{
if ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
h->dynindx = -1;
if (force_local)
{
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
if (h->dynindx != -1)
{
h->dynindx = -1;
_bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
h->dynstr_index);
}
}
if (! ((struct elf32_hppa_link_hash_entry *) h)->plabel)
{
h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
@ -2206,12 +2216,7 @@ clobber_millicode_symbols (h, info)
if (h->type == STT_PARISC_MILLI
&& (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0)
{
struct elf32_hppa_link_hash_table *htab;
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
elf32_hppa_hide_symbol (info, h);
htab = hppa_link_hash_table (info);
_bfd_elf_strtab_delref (htab->elf.dynstr, h->dynstr_index);
elf32_hppa_hide_symbol (info, h, true);
/* ?!? We only want to remove these from the dynamic symbol table.
Therefore we do not leave ELF_LINK_FORCED_LOCAL set. */

View file

@ -211,7 +211,7 @@ static boolean mips_elf_stub_section_p
static int sort_dynamic_relocs
PARAMS ((const void *, const void *));
static void _bfd_mips_elf_hide_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
static void _bfd_mips_elf_copy_indirect_symbol
PARAMS ((struct elf_link_hash_entry *,
struct elf_link_hash_entry *));
@ -4503,9 +4503,10 @@ mips_elf_link_hash_newfunc (entry, table, string)
}
static void
_bfd_mips_elf_hide_symbol (info, entry)
_bfd_mips_elf_hide_symbol (info, entry, force_local)
struct bfd_link_info *info;
struct elf_link_hash_entry *entry;
boolean force_local;
{
bfd *dynobj;
asection *got;
@ -4516,10 +4517,7 @@ _bfd_mips_elf_hide_symbol (info, entry)
got = bfd_get_section_by_name (dynobj, ".got");
g = (struct mips_got_info *) elf_section_data (got)->tdata;
h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
h->root.plt.offset = (bfd_vma) -1;
if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
h->root.dynindx = -1;
_bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
/* FIXME: Do we allocate too much GOT space here? */
g->local_gotno++;

View file

@ -2056,10 +2056,7 @@ elf_link_add_object_symbols (abfd, info)
{
case STV_INTERNAL:
case STV_HIDDEN:
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
(*bed->elf_backend_hide_symbol) (info, h);
_bfd_elf_strtab_delref (hash_table->dynstr,
h->dynstr_index);
(*bed->elf_backend_hide_symbol) (info, h, true);
break;
}
@ -3873,16 +3870,13 @@ elf_fix_symbol_flags (h, eif)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
{
struct elf_backend_data *bed;
boolean force_local;
bed = get_elf_backend_data (elf_hash_table (eif->info)->dynobj);
if (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
{
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
_bfd_elf_strtab_delref (elf_hash_table (eif->info)->dynstr,
h->dynstr_index);
}
(*bed->elf_backend_hide_symbol) (eif->info, h);
force_local = (ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN);
(*bed->elf_backend_hide_symbol) (eif->info, h, force_local);
}
/* If this is a weak defined symbol in a dynamic object, and we know
@ -4233,7 +4227,7 @@ elf_link_assign_sym_version (h, data)
struct bfd_elf_version_expr *d;
len = p - h->root.root.string;
alc = bfd_alloc (sinfo->output_bfd, (bfd_size_type) len);
alc = bfd_malloc ((bfd_size_type) len);
if (alc == NULL)
return false;
strncpy (alc, h->root.root.string, len - 1);
@ -4264,10 +4258,7 @@ elf_link_assign_sym_version (h, data)
&& info->shared
&& ! info->export_dynamic)
{
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
(*bed->elf_backend_hide_symbol) (info, h);
_bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
h->dynstr_index);
(*bed->elf_backend_hide_symbol) (info, h, true);
}
break;
@ -4275,7 +4266,7 @@ elf_link_assign_sym_version (h, data)
}
}
bfd_release (sinfo->output_bfd, alc);
free (alc);
break;
}
}
@ -4379,10 +4370,7 @@ elf_link_assign_sym_version (h, data)
&& info->shared
&& ! info->export_dynamic)
{
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
(*bed->elf_backend_hide_symbol) (info, h);
_bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
h->dynstr_index);
(*bed->elf_backend_hide_symbol) (info, h, true);
}
break;
}
@ -4400,10 +4388,7 @@ elf_link_assign_sym_version (h, data)
&& info->shared
&& ! info->export_dynamic)
{
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
(*bed->elf_backend_hide_symbol) (info, h);
_bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
h->dynstr_index);
(*bed->elf_backend_hide_symbol) (info, h, true);
}
}
}

View file

@ -1,5 +1,5 @@
/* IA-64 support for 64-bit ELF
Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@ -204,7 +204,7 @@ static struct bfd_hash_entry *elfNN_ia64_new_elf_hash_entry
static void elfNN_ia64_hash_copy_indirect
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
static void elfNN_ia64_hash_hide_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, boolean));
static struct bfd_link_hash_table *elfNN_ia64_hash_table_create
PARAMS ((bfd *abfd));
static struct elfNN_ia64_local_hash_entry *elfNN_ia64_local_hash_lookup
@ -1646,18 +1646,17 @@ elfNN_ia64_hash_copy_indirect (xdir, xind)
}
static void
elfNN_ia64_hash_hide_symbol (info, xh)
struct bfd_link_info *info ATTRIBUTE_UNUSED;
elfNN_ia64_hash_hide_symbol (info, xh, force_local)
struct bfd_link_info *info;
struct elf_link_hash_entry *xh;
boolean force_local;
{
struct elfNN_ia64_link_hash_entry *h;
struct elfNN_ia64_dyn_sym_info *dyn_i;
h = (struct elfNN_ia64_link_hash_entry *)xh;
h->root.elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
if ((h->root.elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)
h->root.dynindx = -1;
_bfd_elf_link_hash_hide_symbol (info, &h->root, force_local);
for (dyn_i = h->info; dyn_i; dyn_i = dyn_i->next)
dyn_i->want_plt2 = 0;