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-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
/* 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.
/* 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. */
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 *,
}
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. */
/* 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.
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 *));
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
/* 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
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 *));
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;
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. */
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 *));
}
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;
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++;
{
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;
}
&& (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
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);
&& 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;
}
}
- bfd_release (sinfo->output_bfd, alc);
+ free (alc);
break;
}
}
&& 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;
}
&& 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);
}
}
}
/* 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.
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
}
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;