aboutsummaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-12-22 10:49:23 +1030
committerAlan Modra <amodra@gmail.com>2014-12-23 23:36:50 +1030
commit4cc2bf08a4e18aa2009e9d4f1694a800eacbee17 (patch)
tree8f4ddd987d28c687603ba418ad9129c105313c03 /ld/ldexp.c
parentcd8e2bcf0d51e91ab8da72ec63048790e3720b03 (diff)
downloadgdb-4cc2bf08a4e18aa2009e9d4f1694a800eacbee17.zip
gdb-4cc2bf08a4e18aa2009e9d4f1694a800eacbee17.tar.gz
gdb-4cc2bf08a4e18aa2009e9d4f1694a800eacbee17.tar.bz2
Don't PROVIDE over top of common symbols
This: int end[100000]; int main(void) { end[99999] = 0; return 0; } should not segfault. ld/ * ldexp.c (exp_fold_tree_1 <etree_provide>): Leave bfd_link_hash_common symbols alone. ld/testsuite/ * ld-elf/endsym.s, *ld-elf/endsym.d: New test.
Diffstat (limited to 'ld/ldexp.c')
-rw-r--r--ld/ldexp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ld/ldexp.c b/ld/ldexp.c
index e9e95f9..8615869 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -1070,15 +1070,15 @@ exp_fold_tree_1 (etree_type *tree)
h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst,
FALSE, FALSE, TRUE);
if (h == NULL
- || (h->type != bfd_link_hash_new
- && h->type != bfd_link_hash_undefined
- && h->type != bfd_link_hash_common
- && !(h->type == bfd_link_hash_defined
+ || !(h->type == bfd_link_hash_new
+ || h->type == bfd_link_hash_undefined
+ || (h->type == bfd_link_hash_defined
&& (h->u.def.section->flags
& SEC_LINKER_CREATED) != 0)))
{
- /* Do nothing. The symbol was never referenced, or was
- defined by some object. */
+ /* Do nothing. The symbol was never referenced, or
+ was defined in some object file. Undefined weak
+ symbols stay undefined. */
break;
}
}