From 5072b8e53022f3cb82e21539ce36384303d1a41d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 3 Feb 1994 23:01:49 +0000 Subject: [PATCH] * linker.c (_bfd_generic_link_output_symbols, _bfd_generic_link_write_global_symbol): Don't require that all references to a common symbol be themselves common symbols. --- bfd/ChangeLog | 4 ++++ bfd/linker.c | 22 +++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bdab6ae87a..63c3738002 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,9 @@ Thu Feb 3 16:49:35 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) + * linker.c (_bfd_generic_link_output_symbols, + _bfd_generic_link_write_global_symbol): Don't require that all + references to a common symbol be themselves common symbols. + * aoutx.h (aout_reloc_index_to_section): Handle N_UNDF. Wed Feb 2 20:37:19 1994 Jim Kingdon (kingdon@lioth.cygnus.com) diff --git a/bfd/linker.c b/bfd/linker.c index f70f799437..0803c7db80 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -1656,13 +1656,17 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc) case bfd_link_hash_common: sym->value = h->root.u.c.size; sym->flags |= BSF_GLOBAL; + if (! bfd_is_com_section (sym->section)) + { + BFD_ASSERT (sym->section == &bfd_und_section); + sym->section = &bfd_com_section; + } /* We do not set the section of the symbol to - c.section. c.section is saved so that we know - where to allocate the symbol if we define it. In - this case the type is still bfd_link_hash_common, - so we did not define it, so we do not want to use - that section. */ - BFD_ASSERT (bfd_is_com_section (sym->section)); + h->root.u.c.section. That value was saved so + that we would know where to allocate the symbol + if it was defined. In this case the type is + still bfd_link_hash_common, so we did not define + it, so we do not want to use that section. */ break; } } @@ -1794,8 +1798,12 @@ _bfd_generic_link_write_global_symbol (h, data) break; case bfd_link_hash_common: sym->value = h->root.u.c.size; + if (! bfd_is_com_section (sym->section)) + { + BFD_ASSERT (sym->section == &bfd_und_section); + sym->section = &bfd_com_section; + } /* Do not set the section; see _bfd_generic_link_output_symbols. */ - BFD_ASSERT (bfd_is_com_section (sym->section)); break; case bfd_link_hash_indirect: case bfd_link_hash_warning: