aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2003-12-01 06:28:24 +0000
committerAlan Modra <amodra@gmail.com>2003-12-01 06:28:24 +0000
commit0eddce27a9195929e73ce37c4bd1914b3b88118b (patch)
tree0601b1d855cf38af52622915e32764d3ecd6cffe /bfd/elflink.h
parent68c0be47f86d3127f856cd81e840b4124d4d04c8 (diff)
downloadgdb-0eddce27a9195929e73ce37c4bd1914b3b88118b.zip
gdb-0eddce27a9195929e73ce37c4bd1914b3b88118b.tar.gz
gdb-0eddce27a9195929e73ce37c4bd1914b3b88118b.tar.bz2
* 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.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r--bfd/elflink.h64
1 files changed, 32 insertions, 32 deletions
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)