summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@tuliptree.org>2001-07-05 22:40:16 +0000
committerJim Wilson <wilson@tuliptree.org>2001-07-05 22:40:16 +0000
commit78a6b11e6952ad7f92c5b8a1c4450207e14c7372 (patch)
treedeadd3c337e3fe0fb697b57f66b9ef34392afa47
parentbc95eb3719a0c19b152abf320d2b59f99435577e (diff)
downloadgdb-78a6b11e6952ad7f92c5b8a1c4450207e14c7372.tar.gz
Fix ia64-linux fortran common linking problem.
* linker.c (_bfd_generic_link_add_one_symbol, case BIG): Use the section of the bigger symbol.
-rw-r--r--bfd/ChangeLog3
-rw-r--r--bfd/linker.c21
2 files changed, 23 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ec94ce98e2e..b4937f55e78 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,8 @@
2001-07-05 Jim Wilson <wilson@redhat.com>
+ * linker.c (_bfd_generic_link_add_one_symbol, case BIG): Use
+ the section of the bigger symbol.
+
* syms.c (bfd_is_local_label): Return false if BSF_SECTION_SYM.
2001-07-05 Nick Clifton <nickc@cambridge.redhat.com>
diff --git a/bfd/linker.c b/bfd/linker.c
index 08772894890..54781868e7a 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -1698,7 +1698,7 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
case BIG:
/* We have found a common definition for a symbol which
already had a common definition. Use the maximum of the
- two sizes. */
+ two sizes, and use the section required by the larger symbol. */
BFD_ASSERT (h->type == bfd_link_hash_common);
if (! ((*info->callbacks->multiple_common)
(info, h->root.string,
@@ -1717,6 +1717,25 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
if (power > 4)
power = 4;
h->u.c.p->alignment_power = power;
+
+ /* Some systems have special treatment for small commons,
+ hence we want to select the section used by the larger
+ symbol. This makes sure the symbol does not go in a
+ small common section if it is now too large. */
+ if (section == bfd_com_section_ptr)
+ {
+ h->u.c.p->section
+ = bfd_make_section_old_way (abfd, "COMMON");
+ h->u.c.p->section->flags = SEC_ALLOC;
+ }
+ else if (section->owner != abfd)
+ {
+ h->u.c.p->section
+ = bfd_make_section_old_way (abfd, section->name);
+ h->u.c.p->section->flags = SEC_ALLOC;
+ }
+ else
+ h->u.c.p->section = section;
}
break;