* elf.c (_bfd_elf_merge_sections): Adjust to suit.
(_bfd_elf_link_just_syms): Likewise.
(bfd_elf_get_needed_list): Likewise.
(bfd_elf_get_runpath_list): Likewise.
(_bfd_elf_link_hash_copy_indirect): Remove unneeded parens.
* elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab
creator flavour.
(elf32_hppa_set_gp): Look up output sections rather than using htab.
* elf32-i960.c: Comment fix. Formatting.
* elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table
rather than testing creator flavour.
* elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
* elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
* elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for
is_elf_hash_table change. Remove redundant test.
(bfd_elf_record_link_assignment): Use is_elf_hash_table rather than
testing creator flavour.
(elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table.
(_bfd_elf_fix_symbol_flags): Likewise.
(_bfd_elf_adjust_dynamic_symbol): Likewise.
* elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant
checks. Use is_elf_hash_table rather than testing creator flavour.
Use hash_table throughout in place of info->hash.
(elf_add_dynamic_entry): Adjust for is_elf_hash_table change.
(NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant
check.
(elf_bfd_final_link): Adjust for is_elf_hash_table change.
(elf_link_check_versioned_symbol): Use is_elf_hash_table rather than
testing creator flavour.
(elf_gc_sections): Add is_elf_hash_table check.
(elf_gc_common_finalize_got_offsets): Likewise.
(elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove
redundant check.
* elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table
rather than testing creator flavour.
+2003-12-01 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (is_elf_hash_table): Take hash tab rather than info arg.
+ * elf.c (_bfd_elf_merge_sections): Adjust to suit.
+ (_bfd_elf_link_just_syms): Likewise.
+ (bfd_elf_get_needed_list): Likewise.
+ (bfd_elf_get_runpath_list): Likewise.
+ (_bfd_elf_link_hash_copy_indirect): Remove unneeded parens.
+ * elf32-hppa.c (elf32_hppa_setup_section_lists): Don't check hash tab
+ creator flavour.
+ (elf32_hppa_set_gp): Look up output sections rather than using htab.
+ * elf32-i960.c: Comment fix. Formatting.
+ * elf32-m32r.c (m32r_elf_add_symbol_hook): Use is_elf_hash_table
+ rather than testing creator flavour.
+ * elf32-sh64.c (sh64_elf_add_symbol_hook): Likewise.
+ * elf64-sh64.c (sh64_elf64_add_symbol_hook): Likewise.
+ * elflink.c (_bfd_elf_link_create_dynamic_sections): Adjust for
+ is_elf_hash_table change. Remove redundant test.
+ (bfd_elf_record_link_assignment): Use is_elf_hash_table rather than
+ testing creator flavour.
+ (elf_link_record_local_dynamic_symbol): Adjust for is_elf_hash_table.
+ (_bfd_elf_fix_symbol_flags): Likewise.
+ (_bfd_elf_adjust_dynamic_symbol): Likewise.
+ * elflink.h (elf_link_add_object_symbols): Likewise. Remove redundant
+ checks. Use is_elf_hash_table rather than testing creator flavour.
+ Use hash_table throughout in place of info->hash.
+ (elf_add_dynamic_entry): Adjust for is_elf_hash_table change.
+ (NAME(bfd_elf,size_dynamic_sections)): Likewise. Remove redundant
+ check.
+ (elf_bfd_final_link): Adjust for is_elf_hash_table change.
+ (elf_link_check_versioned_symbol): Use is_elf_hash_table rather than
+ testing creator flavour.
+ (elf_gc_sections): Add is_elf_hash_table check.
+ (elf_gc_common_finalize_got_offsets): Likewise.
+ (elf_bfd_discard_info): Adjust for is_elf_hash_table change. Remove
+ redundant check.
+ * elfxx-ia64.c (elfNN_ia64_relax_section): Use is_elf_hash_table
+ rather than testing creator flavour.
+
2003-11-28 Christian Groessler <chris@groessler.org>
* cpu-z8k.c: Convert to ISO C90.
of the note.
2003-11-26 Daniel Jacobowitz <drow@mvista.com>
- Richard Sandiford <rsandifo@redhat.com>
+ Richard Sandiford <rsandifo@redhat.com>
* elfxx-mips.c (mips_elf_set_global_got_offset): Don't set no_fn_stub.
(mips_elf_set_no_stub): New function.
#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))
/* Returns TRUE if the hash table is a struct elf_link_hash_table. */
-#define is_elf_hash_table(p) \
- ((p)->hash->type == bfd_link_elf_hash_table)
+#define is_elf_hash_table(htab) \
+ (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
/* Used by bfd_section_from_r_symndx to cache a small number of local
symbol to section mappings. */
bfd_boolean
_bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info)
{
- if (!is_elf_hash_table (info))
+ if (!is_elf_hash_table (info->hash))
return FALSE;
if (elf_hash_table (info)->merge_info)
_bfd_merge_sections (abfd, elf_hash_table (info)->merge_info,
{
sec->output_section = bfd_abs_section_ptr;
sec->output_offset = sec->vma;
- if (!is_elf_hash_table (info))
+ if (!is_elf_hash_table (info->hash))
return;
sec->sec_info_type = ELF_INFO_TYPE_JUST_SYMS;
symbol which just became indirect. */
dir->elf_link_hash_flags
- |= (ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
- | ELF_LINK_HASH_REF_REGULAR
- | ELF_LINK_HASH_REF_REGULAR_NONWEAK
- | ELF_LINK_NON_GOT_REF
- | ELF_LINK_HASH_NEEDS_PLT
- | ELF_LINK_POINTER_EQUALITY_NEEDED));
+ |= ind->elf_link_hash_flags & (ELF_LINK_HASH_REF_DYNAMIC
+ | ELF_LINK_HASH_REF_REGULAR
+ | ELF_LINK_HASH_REF_REGULAR_NONWEAK
+ | ELF_LINK_NON_GOT_REF
+ | ELF_LINK_HASH_NEEDS_PLT
+ | ELF_LINK_POINTER_EQUALITY_NEEDED);
if (ind->root.type != bfd_link_hash_indirect)
return;
bfd_elf_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return NULL;
return elf_hash_table (info)->needed;
}
bfd_elf_get_runpath_list (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return NULL;
return elf_hash_table (info)->runpath;
}
bfd_size_type amt;
struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
- if (htab->elf.root.creator->flavour != bfd_target_elf_flavour)
- return 0;
-
/* Count the number of input BFDs and find the top input section id. */
for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
input_bfd != NULL;
}
else
{
- asection *splt;
- asection *sgot;
-
- if (htab->elf.root.creator->flavour == bfd_target_elf_flavour)
- {
- splt = htab->splt;
- sgot = htab->sgot;
- }
- else
- {
- /* If we're not elf, look up the output sections in the
- hope we may actually find them. */
- splt = bfd_get_section_by_name (abfd, ".plt");
- sgot = bfd_get_section_by_name (abfd, ".got");
- }
+ asection *splt = bfd_get_section_by_name (abfd, ".plt");
+ asection *sgot = bfd_get_section_by_name (abfd, ".got");
/* Choose to point our LTP at, in this order, one of .plt, .got,
or .data, if these sections exist. In the case of choosing
-/* Intel 860 specific support for 32-bit ELF
+/* Intel 960 specific support for 32-bit ELF
Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
relocatable output against an external symbol. */
bfd_reloc_status_type
-elf32_i960_relocate (abfd,
- reloc_entry,
- symbol,
- data,
- input_section,
- output_bfd,
- error_message)
+elf32_i960_relocate (abfd, reloc_entry, symbol, data, input_section,
+ output_bfd, error_message)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *reloc_entry;
asymbol *symbol;
if (! info->relocatable
&& (*namep)[0] == '_' && (*namep)[1] == 'S'
&& strcmp (*namep, "_SDA_BASE_") == 0
- && info->hash->creator->flavour == bfd_target_elf_flavour)
+ && is_elf_hash_table (info->hash))
{
/* This is simpler than using _bfd_elf_create_linker_section
(our needs are simpler than ppc's needs). Also
{
/* We want to do this for relocatable as well as final linking. */
if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL
- && info->hash->creator->flavour == bfd_target_elf_flavour)
+ && is_elf_hash_table (info->hash))
{
struct elf_link_hash_entry *h;
{
/* We want to do this for relocatable as well as final linking. */
if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL
- && info->hash->creator->flavour == bfd_target_elf_flavour)
+ && is_elf_hash_table (info->hash))
{
struct elf_link_hash_entry *h;
struct bfd_link_hash_entry *bh;
const struct elf_backend_data *bed;
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return FALSE;
if (elf_hash_table (info)->dynamic_sections_created)
return FALSE;
}
- if (! info->traditional_format
- && info->hash->creator->flavour == bfd_target_elf_flavour)
+ if (! info->traditional_format)
{
s = bfd_make_section (abfd, ".eh_frame_hdr");
if (s == NULL
{
struct elf_link_hash_entry *h;
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
+ if (!is_elf_hash_table (info->hash))
return TRUE;
h = elf_link_hash_lookup (elf_hash_table (info), name, TRUE, TRUE, FALSE);
Elf_External_Sym_Shndx eshndx;
char esym[sizeof (Elf64_External_Sym)];
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return 0;
/* See if the entry exists already. */
will force it local. */
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0
&& eif->info->shared
- && is_elf_hash_table (eif->info)
+ && is_elf_hash_table (eif->info->hash)
&& (eif->info->symbolic
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0)
bfd *dynobj;
const struct elf_backend_data *bed;
- if (! is_elf_hash_table (eif->info))
+ if (! is_elf_hash_table (eif->info->hash))
return FALSE;
if (h->root.type == bfd_link_hash_warning)
/* You can't use -r against a dynamic object. Also, there's no
hope of using a dynamic object which does not exactly match
the format of the output file. */
- if (info->relocatable || info->hash->creator != abfd->xvec)
+ if (info->relocatable
+ || !is_elf_hash_table (hash_table)
+ || hash_table->root.creator != abfd->xvec)
{
bfd_set_error (bfd_error_invalid_operation);
goto error_return;
fix is to keep track of what warnings we are supposed
to emit, and then handle them all at the end of the
link. */
- if (dynamic && abfd->xvec == info->hash->creator)
+ if (dynamic)
{
struct elf_link_hash_entry *h;
format. FIXME: If there are no input BFD's of the same
format as the output, we can't make a shared library. */
if (info->shared
- && is_elf_hash_table (info)
- && ! hash_table->dynamic_sections_created
- && abfd->xvec == info->hash->creator)
+ && is_elf_hash_table (hash_table)
+ && hash_table->root.creator == abfd->xvec
+ && ! hash_table->dynamic_sections_created)
{
if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
goto error_return;
}
}
- else if (! is_elf_hash_table (info))
+ else if (!is_elf_hash_table (hash_table))
goto error_return;
else
{
/* If this is the first dynamic object found in the link, create
the special sections required for dynamic linking. */
- if (! hash_table->dynamic_sections_created)
- if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
- goto error_return;
+ if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
+ goto error_return;
if (add_needed)
{
old_alignment = 0;
old_bfd = NULL;
- if (info->hash->creator->flavour == bfd_target_elf_flavour)
+ if (is_elf_hash_table (hash_table))
{
Elf_Internal_Versym iver;
unsigned int vernum = 0;
&& definition
&& (flags & BSF_WEAK) != 0
&& ELF_ST_TYPE (isym->st_info) != STT_FUNC
- && info->hash->creator->flavour == bfd_target_elf_flavour
+ && is_elf_hash_table (hash_table)
&& h->weakdef == NULL)
{
/* Keep a list of all weak defined non function symbols from
h->root.u.c.p->alignment_power = old_alignment;
}
- if (info->hash->creator->flavour == bfd_target_elf_flavour)
+ if (is_elf_hash_table (hash_table))
{
int old_flags;
bfd_boolean dynsym;
bfd_size_type oldsize;
bfd_size_type strindex;
- if (! is_elf_hash_table (info))
- goto error_free_vers;
-
/* The symbol from a DT_NEEDED object is referenced from
the regular object to create a dynamic executable. We
have to make sure there is a DT_NEEDED entry for it. */
shortname[amt] = '\0';
hi = (struct elf_link_hash_entry *)
- bfd_link_hash_lookup (info->hash, shortname,
+ bfd_link_hash_lookup (&hash_table->root, shortname,
FALSE, FALSE, FALSE);
if (hi != NULL
&& hi->root.type == h->root.type
different format. It probably can't be done. */
check_relocs = get_elf_backend_data (abfd)->check_relocs;
if (! dynamic
- && abfd->xvec == info->hash->creator
+ && is_elf_hash_table (hash_table)
+ && hash_table->root.creator == abfd->xvec
&& check_relocs != NULL)
{
asection *o;
of the .stab/.stabstr sections. */
if (! dynamic
&& ! info->traditional_format
- && info->hash->creator->flavour == bfd_target_elf_flavour
- && is_elf_hash_table (info)
+ && is_elf_hash_table (hash_table)
&& (info->strip != strip_all && info->strip != strip_debugger))
{
asection *stabstr;
}
}
- if (! info->relocatable && ! dynamic
- && is_elf_hash_table (info))
+ if (! info->relocatable
+ && ! dynamic
+ && is_elf_hash_table (hash_table))
{
asection *s;
}
}
- if (is_elf_hash_table (info))
+ if (is_elf_hash_table (hash_table))
{
/* Add this bfd to the loaded list. */
struct elf_link_loaded_list *n;
bfd_size_type newsize;
bfd_byte *newcontents;
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return FALSE;
dynobj = elf_hash_table (info)->dynobj;
soname_indx = (bfd_size_type) -1;
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
- return TRUE;
-
- if (! is_elf_hash_table (info))
+ if (!is_elf_hash_table (info->hash))
return TRUE;
if (info->execstack)
asection *reldyn = 0;
bfd_size_type amt;
- if (! is_elf_hash_table (info))
+ if (! is_elf_hash_table (info->hash))
return FALSE;
if (info->shared)
bfd *abfd;
struct elf_link_loaded_list *loaded;
- if (info->hash->creator->flavour != bfd_target_elf_flavour)
+ if (!is_elf_hash_table (info->hash))
return FALSE;
switch (h->root.type)
struct elf_link_hash_entry *h, Elf_Internal_Sym *);
if (!get_elf_backend_data (abfd)->can_gc_sections
- || info->relocatable || info->emitrelocations
+ || info->relocatable
+ || info->emitrelocations
+ || !is_elf_hash_table (info->hash)
|| elf_hash_table (info)->dynamic_sections_created)
return TRUE;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
bfd_vma gotoff;
+ if (! is_elf_hash_table (info->hash))
+ return FALSE;
+
/* The GOT offset is relative to the .got section, but the GOT header is
put into the .got.plt section, if the backend uses it. */
if (bed->want_got_plt)
bfd_boolean ret = FALSE;
if (info->traditional_format
- || info->hash->creator->flavour != bfd_target_elf_flavour
- || ! is_elf_hash_table (info))
+ || !is_elf_hash_table (info->hash))
return FALSE;
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link_next)
*again = FALSE;
/* Don't even try to relax for non-ELF outputs. */
- if (link_info->hash->creator->flavour != bfd_target_elf_flavour)
+ if (!is_elf_hash_table (link_info->hash))
return FALSE;
/* Nothing to do if there are no relocations or there is no need for