aboutsummaryrefslogtreecommitdiff
path: root/bfd/i386linux.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-02-06 20:01:08 +0000
committerIan Lance Taylor <ian@airs.com>1995-02-06 20:01:08 +0000
commit6c97aedf2686633d3e837802ce51ebe630f64056 (patch)
treebb409db186375bad6ede2a558c8a29d9dd1cb950 /bfd/i386linux.c
parentebc4ca90f97420f225f48141c631405357b58c16 (diff)
downloadgdb-6c97aedf2686633d3e837802ce51ebe630f64056.zip
gdb-6c97aedf2686633d3e837802ce51ebe630f64056.tar.gz
gdb-6c97aedf2686633d3e837802ce51ebe630f64056.tar.bz2
Distinguish a weak defined symbol from a regular defined symbol.
* linker.c (enum link_action): Add DEFW. (link_action): Add bfd_link_hash_defweak column. (_bfd_generic_link_add_one_symbol): Add DEFW case. Handle bfd_link_hash_defweak in a few other cases. * Many files (bfd_link_hash_undefweak): Renamed from bfd_link_hash_weak. * aoutx.h (aout_link_write_symbols): Handle bfd_link_hash_defweak. (aout_link_write_other_symbol): Likewise. (aout_link_input_section_std): Likewise. (aout_link_input_section_ext): Likewise. * bout.c (get_value): Likewise. * coff-a29k.c (coff_a29k_relocate_section): Likewise. * coff-alpha.c (alpha_convert_external_reloc): Likewise. (alpha_relocate_section): Likewise. * coff-mips.c (mips_relocate_section): Likewise. (mips_relax_section): Likewise. (bfd_mips_ecoff_create_embedded_relocs): Likewise. * cofflink.c (coff_write_global_sym): Likewise. (_bfd_coff_generic_relocate_section): Likewise. * ecoff.c (ecoff_link_add_externals): Likewise. (ecoff_link_write_external): LIkewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. (elf32_hppa_size_stubs): Likewise. * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Likewise. (elf_i386_relocate_section): Likewise. (elf_i386_finish_dynamic_symbol): Likewise. * elf32-mips.c (mips_elf_output_extsym): Likewise. (mips_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise. (elf32_sparc_relocate_section): Likewise. * elfcode.h (elf_link_add_object_symbols): Likewise. (elf_adjust_dynamic_symbol): Likewise. (elf_bfd_final_link): Likewise. (elf_link_output_extsym): Likewise. * i386linux.c (linux_add_one_symbol): Likewise. (linux_tally_symbols): Likewise. (linux_finish_dynamic_link): Likewise. * linker.c (_bfd_generic_link_output_symbols): Likewise. (set_symbol_from_hash): Likewise. * reloc16.c (bfd_coff_reloc16_get_value): Likewise. (bfd_perform_slip): Likewise. * sunos.c (sunos_add_one_symbol): Likewise. (sunos_scan_std_relocs): Likewise. (sunos_scan_ext_relocs): Likewise. (sunos_scan_dynamic_symbol): Likewise. (sunos_write_dynamic_symbol): Likewise.
Diffstat (limited to 'bfd/i386linux.c')
-rw-r--r--bfd/i386linux.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/bfd/i386linux.c b/bfd/i386linux.c
index 7bd67ca..91d4143 100644
--- a/bfd/i386linux.c
+++ b/bfd/i386linux.c
@@ -342,7 +342,8 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
if (! info->relocateable
&& linux_hash_table (info)->dynobj == NULL
&& strcmp (name, SHARABLE_CONFLICTS) == 0
- && (flags & BSF_CONSTRUCTOR) != 0)
+ && (flags & BSF_CONSTRUCTOR) != 0
+ && abfd->xvec == info->hash->creator)
{
if (! linux_link_create_dynamic_sections (abfd, info))
return false;
@@ -351,12 +352,13 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
}
if (bfd_is_abs_section (section)
- && (IS_GOT_SYM (name) || IS_PLT_SYM (name)))
+ && abfd->xvec == info->hash->creator)
{
h = linux_link_hash_lookup (linux_hash_table (info), name, false,
false, false);
if (h != NULL
- && h->root.root.type == bfd_link_hash_defined)
+ && (h->root.root.type == bfd_link_hash_defined
+ || h->root.root.type == bfd_link_hash_defweak))
{
struct fixup *f;
@@ -445,7 +447,8 @@ linux_tally_symbols (h, data)
fixup anyway, since there are cases where these symbols come
from different shared libraries */
if (h1 != NULL
- && ((h1->root.root.type == bfd_link_hash_defined
+ && (((h1->root.root.type == bfd_link_hash_defined
+ || h1->root.root.type == bfd_link_hash_defweak)
&& ! bfd_is_abs_section (h1->root.root.u.def.section))
|| h2->root.root.type == bfd_link_hash_indirect))
{
@@ -458,9 +461,11 @@ linux_tally_symbols (h, data)
f1 != NULL;
f1 = f1->next)
{
- if (f1->h != h
+ if ((f1->h != h && f1->h != h1)
|| (! f1->builtin && ! f1->jump))
continue;
+ if (f1->h == h1)
+ exists = true;
if (! exists
&& bfd_is_abs_section (h->root.root.u.def.section))
{
@@ -593,7 +598,8 @@ linux_finish_dynamic_link (output_bfd, info)
if (f->builtin)
continue;
- if (f->h->root.root.type != bfd_link_hash_defined)
+ if (f->h->root.root.type != bfd_link_hash_defined
+ && f->h->root.root.type != bfd_link_hash_defweak)
{
/* FIXME! */
fprintf (stderr,
@@ -643,7 +649,8 @@ linux_finish_dynamic_link (output_bfd, info)
if (! f->builtin)
continue;
- if (f->h->root.root.type != bfd_link_hash_defined)
+ if (f->h->root.root.type != bfd_link_hash_defined
+ && f->h->root.root.type != bfd_link_hash_defweak)
{
/* FIXME! */
fprintf (stderr,
@@ -687,7 +694,9 @@ linux_finish_dynamic_link (output_bfd, info)
"__BUILTIN_FIXUPS__",
false, false, false);
- if (h != NULL && h->root.root.type == bfd_link_hash_defined)
+ if (h != NULL
+ && (h->root.root.type == bfd_link_hash_defined
+ || h->root.root.type == bfd_link_hash_defweak))
{
is = h->root.root.u.def.section;
section_offset = is->output_section->vma + is->output_offset;