diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 41 | ||||
-rw-r--r-- | bfd/elf-bfd.h | 4 | ||||
-rw-r--r-- | bfd/elf.c | 20 | ||||
-rw-r--r-- | bfd/elf32-hppa.c | 20 | ||||
-rw-r--r-- | bfd/elf32-i960.c | 11 | ||||
-rw-r--r-- | bfd/elf32-m32r.c | 2 | ||||
-rw-r--r-- | bfd/elf32-sh64.c | 2 | ||||
-rw-r--r-- | bfd/elf64-sh64.c | 2 | ||||
-rw-r--r-- | bfd/elflink.c | 13 | ||||
-rw-r--r-- | bfd/elflink.h | 64 | ||||
-rw-r--r-- | bfd/elfxx-ia64.c | 2 |
11 files changed, 99 insertions, 82 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a5d422e..a93e80f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,42 @@ +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. @@ -23,7 +62,7 @@ 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. diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 1c608a5..0a2f6b2 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -400,8 +400,8 @@ struct elf_link_hash_table #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. */ @@ -894,7 +894,7 @@ merge_sections_remove_hook (bfd *abfd ATTRIBUTE_UNUSED, 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, @@ -907,7 +907,7 @@ _bfd_elf_link_just_syms (asection *sec, struct bfd_link_info *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; @@ -1355,12 +1355,12 @@ _bfd_elf_link_hash_copy_indirect (const struct elf_backend_data *bed, 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; @@ -1504,7 +1504,7 @@ struct bfd_link_needed_list * 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; } @@ -1516,7 +1516,7 @@ struct bfd_link_needed_list * 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; } diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 51f070d..cf6c630 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -2305,9 +2305,6 @@ elf32_hppa_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info) 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; @@ -2911,21 +2908,8 @@ elf32_hppa_set_gp (bfd *abfd, struct bfd_link_info *info) } 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 diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c index 6218e1a..99e5585 100644 --- a/bfd/elf32-i960.c +++ b/bfd/elf32-i960.c @@ -1,4 +1,4 @@ -/* 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. @@ -107,13 +107,8 @@ elf32_i960_info_to_howto_rel (abfd, cache_ptr, dst) 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; diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 7500f56..e0a4d13 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -843,7 +843,7 @@ m32r_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) 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 diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index c3be09f..8760f60 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -380,7 +380,7 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, { /* 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; diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index db096a5..338278e 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -2892,7 +2892,7 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info, { /* 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; diff --git a/bfd/elflink.c b/bfd/elflink.c index 44cf1e4..f58a67a 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -117,7 +117,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) 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) @@ -144,8 +144,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) 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 @@ -424,7 +423,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd ATTRIBUTE_UNUSED, { 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); @@ -494,7 +493,7 @@ elf_link_record_local_dynamic_symbol (struct bfd_link_info *info, 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. */ @@ -2206,7 +2205,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h, 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) @@ -2276,7 +2275,7 @@ _bfd_elf_adjust_dynamic_symbol (struct elf_link_hash_entry *h, void *data) 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) diff --git a/bfd/elflink.h b/bfd/elflink.h index de1fa77..b02f024 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -437,7 +437,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) /* 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; @@ -475,7 +477,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) 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; @@ -531,15 +533,15 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) 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 { @@ -723,9 +725,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) /* 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) { @@ -968,7 +969,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) 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; @@ -1131,7 +1132,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) && 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 @@ -1167,7 +1168,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) 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; @@ -1380,9 +1381,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) 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. */ @@ -1446,7 +1444,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) 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 @@ -1573,7 +1571,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) 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; @@ -1609,8 +1608,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) 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; @@ -1643,8 +1641,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } } - if (! info->relocatable && ! dynamic - && is_elf_hash_table (info)) + if (! info->relocatable + && ! dynamic + && is_elf_hash_table (hash_table)) { asection *s; @@ -1664,7 +1663,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) } } - 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; @@ -1702,7 +1701,7 @@ elf_add_dynamic_entry (struct bfd_link_info *info, bfd_vma tag, bfd_vma val) 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; @@ -1907,10 +1906,7 @@ NAME(bfd_elf,size_dynamic_sections) (bfd *output_bfd, 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) @@ -3112,7 +3108,7 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info) 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) @@ -4188,7 +4184,7 @@ elf_link_check_versioned_symbol (struct bfd_link_info *info, 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) @@ -5797,7 +5793,9 @@ elf_gc_sections (bfd *abfd, struct bfd_link_info *info) 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; @@ -5973,6 +5971,9 @@ elf_gc_common_finalize_got_offsets (bfd *abfd, 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) @@ -6179,8 +6180,7 @@ elf_bfd_discard_info (bfd *output_bfd, struct bfd_link_info *info) 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) diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 49317c6..c9da05f 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -707,7 +707,7 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) *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 |