summaryrefslogtreecommitdiff
path: root/bfd/elflink.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1999-12-10 01:41:22 +0000
committerNick Clifton <nickc@redhat.com>1999-12-10 01:41:22 +0000
commit187eccd48087c785f20d9ef70979843ead9e59f0 (patch)
tree4223511bfa4407acc66f41044f4456b8d4758f42 /bfd/elflink.h
parent217a83bbe99aa0b928070e7cc4ad510b92c31f54 (diff)
downloadgdb-187eccd48087c785f20d9ef70979843ead9e59f0.tar.gz
Change AR for ELF so that common symbols are not included in archive map.
Change LD for ELF so that archive elements whoes archive map contains a reference to a common symbol will get linkled in. Add new field to bfd_target structure and initialise it for all bfd targets.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r--bfd/elflink.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h
index ab679a70d0d..2a8c3db1e14 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -200,7 +200,26 @@ elf_link_add_archive_symbols (abfd, info)
if (h == NULL)
continue;
- if (h->root.type != bfd_link_hash_undefined)
+ /* We have changed the GNU archiver so that it will only place
+ non-common symbols into its archive map. Thus if we come across
+ a symbol in the archive map, which is currently considered to be
+ a common symbol, we can safely assume that we should link the
+ element in, in order to get in the definition of the symbol.
+
+ Previous versions of the archiver would place common symbols into
+ the archive map. This meant that in order to only link in an
+ element if it contained a *definition* of a common symbol, it
+ would be necessary to read in the element and scan its symbol
+ table - a slow and wasteful process.
+
+ In fact previous versions of this code did not even do that,
+ instead it just unilaterally ignored any symbols in the archive
+ map which were currently marked as common. So in order to link
+ in an archive element containing the definition of a common
+ symbol it was necessary to have that element also contain the
+ defintion of a currently undefined symbol. */
+ if (h->root.type != bfd_link_hash_undefined
+ && h->root.type != bfd_link_hash_common)
{
if (h->root.type != bfd_link_hash_undefweak)
defined[i] = true;