diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-02-06 20:01:08 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-02-06 20:01:08 +0000 |
commit | 6c97aedf2686633d3e837802ce51ebe630f64056 (patch) | |
tree | bb409db186375bad6ede2a558c8a29d9dd1cb950 /bfd/sunos.c | |
parent | ebc4ca90f97420f225f48141c631405357b58c16 (diff) | |
download | gdb-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/sunos.c')
-rw-r--r-- | bfd/sunos.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/bfd/sunos.c b/bfd/sunos.c index 157eba9..427beb4 100644 --- a/bfd/sunos.c +++ b/bfd/sunos.c @@ -1,5 +1,5 @@ /* BFD backend for SunOS binaries. - Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc. + Copyright (C) 1990, 91, 92, 93, 94, 1995 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -859,7 +859,8 @@ sunos_add_one_symbol (info, abfd, name, flags, section, value, string, if (! bfd_is_und_section (section) && h->root.root.type != bfd_link_hash_new - && h->root.root.type != bfd_link_hash_undefined) + && h->root.root.type != bfd_link_hash_undefined + && h->root.root.type != bfd_link_hash_defweak) { /* We are defining the symbol, and it is already defined. This is a potential multiple definition error. */ @@ -1297,9 +1298,10 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) /* At this point common symbols have already been allocated, so we don't have to worry about them. We need to consider that we may have already seen this symbol and marked it undefined; - if the symbols is really undefined, then SUNOS_DEF_DYNAMIC + if the symbol is really undefined, then SUNOS_DEF_DYNAMIC will be zero. */ if (h->root.root.type != bfd_link_hash_defined + && h->root.root.type != bfd_link_hash_defweak && h->root.root.type != bfd_link_hash_undefined) continue; @@ -1308,7 +1310,8 @@ sunos_scan_std_relocs (info, abfd, sec, relocs, rel_size) continue; BFD_ASSERT ((h->flags & SUNOS_REF_REGULAR) != 0); - BFD_ASSERT (h->root.root.type == bfd_link_hash_defined + BFD_ASSERT ((h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak) ? (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0 : (h->root.root.u.undef.abfd->flags & DYNAMIC) != 0); @@ -1444,6 +1447,7 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) if the symbols is really undefined, then SUNOS_DEF_DYNAMIC will be zero. */ if (h->root.root.type != bfd_link_hash_defined + && h->root.root.type != bfd_link_hash_defweak && h->root.root.type != bfd_link_hash_undefined) continue; @@ -1452,7 +1456,8 @@ sunos_scan_ext_relocs (info, abfd, sec, relocs, rel_size) continue; BFD_ASSERT ((h->flags & SUNOS_REF_REGULAR) != 0); - BFD_ASSERT (h->root.root.type == bfd_link_hash_defined + BFD_ASSERT ((h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak) ? (h->root.root.u.def.section->owner->flags & DYNAMIC) != 0 : (h->root.root.u.undef.abfd->flags & DYNAMIC) != 0); @@ -1527,7 +1532,8 @@ sunos_scan_dynamic_symbol (h, data) && (h->flags & SUNOS_DEF_DYNAMIC) != 0 && (h->flags & SUNOS_REF_REGULAR) != 0) { - if (h->root.root.type == bfd_link_hash_defined + if ((h->root.root.type == bfd_link_hash_defined + || h->root.root.type == bfd_link_hash_defweak) && ((h->root.root.u.def.section->owner->flags & DYNAMIC) != 0) && h->root.root.u.def.section->output_section == NULL) { @@ -1665,6 +1671,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg) val = 0; break; case bfd_link_hash_defined: + case bfd_link_hash_defweak: { asection *sec; asection *output_section; @@ -1682,13 +1689,22 @@ sunos_write_dynamic_symbol (output_bfd, info, harg) else { if (output_section == obj_textsec (output_bfd)) - type = N_TEXT | N_EXT; + type = (h->root.root.type == bfd_link_hash_defined + ? N_TEXT + : N_WEAKT); else if (output_section == obj_datasec (output_bfd)) - type = N_DATA | N_EXT; + type = (h->root.root.type == bfd_link_hash_defined + ? N_DATA + : N_WEAKD); else if (output_section == obj_bsssec (output_bfd)) - type = N_BSS | N_EXT; + type = (h->root.root.type == bfd_link_hash_defined + ? N_BSS + : N_WEAKB); else - type = N_ABS | N_EXT; + type = (h->root.root.type == bfd_link_hash_defined + ? N_ABS + : N_WEAKA); + type |= N_EXT; val = (h->root.root.u.def.value + output_section->vma + sec->output_offset); @@ -1699,7 +1715,7 @@ sunos_write_dynamic_symbol (output_bfd, info, harg) type = N_UNDF | N_EXT; val = h->root.root.u.c.size; break; - case bfd_link_hash_weak: + case bfd_link_hash_undefweak: type = N_WEAKU; val = 0; break; |