aboutsummaryrefslogtreecommitdiff
path: root/bfd/linker.c
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
commit0a2afbc13afe370f2bf24139c525a256c0130faa (patch)
tree3fcd969a3e8fd885dada140825d45d1657fe6b45 /bfd/linker.c
parentbdda63b0c5cf6785c3c6583c12bd2b111f7993b6 (diff)
downloadgdb-0a2afbc13afe370f2bf24139c525a256c0130faa.zip
gdb-0a2afbc13afe370f2bf24139c525a256c0130faa.tar.gz
gdb-0a2afbc13afe370f2bf24139c525a256c0130faa.tar.bz2
Fix ia64-linux fortran common linking problem.
* linker.c (_bfd_generic_link_add_one_symbol, case BIG): Use the section of the bigger symbol.
Diffstat (limited to 'bfd/linker.c')
-rw-r--r--bfd/linker.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/bfd/linker.c b/bfd/linker.c
index 0877289..5478186 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;