aboutsummaryrefslogtreecommitdiff
path: root/bfd/linker.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-02-03 23:01:49 +0000
committerIan Lance Taylor <ian@airs.com>1994-02-03 23:01:49 +0000
commit5072b8e53022f3cb82e21539ce36384303d1a41d (patch)
treeb5c960bb950e14ec230f6dcc40fbc87d1e9c1171 /bfd/linker.c
parent250e36fe2dc883cb6652327c782aa6beac794253 (diff)
downloadgdb-5072b8e53022f3cb82e21539ce36384303d1a41d.zip
gdb-5072b8e53022f3cb82e21539ce36384303d1a41d.tar.gz
gdb-5072b8e53022f3cb82e21539ce36384303d1a41d.tar.bz2
* 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.
Diffstat (limited to 'bfd/linker.c')
-rw-r--r--bfd/linker.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/bfd/linker.c b/bfd/linker.c
index f70f799..0803c7d 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: