mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 04:49:54 +08:00
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.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2014-12-23 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* ldexp.c (exp_fold_tree_1 <etree_provide>): Leave bfd_link_hash_common
|
||||||
|
symbols alone.
|
||||||
|
|
||||||
2014-12-23 Alan Modra <amodra@gmail.com>
|
2014-12-23 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* ldexp.c (update_definedness): Correct logic setting by_object.
|
* ldexp.c (update_definedness): Correct logic setting by_object.
|
||||||
|
12
ld/ldexp.c
12
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,
|
h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst,
|
||||||
FALSE, FALSE, TRUE);
|
FALSE, FALSE, TRUE);
|
||||||
if (h == NULL
|
if (h == NULL
|
||||||
|| (h->type != bfd_link_hash_new
|
|| !(h->type == bfd_link_hash_new
|
||||||
&& h->type != bfd_link_hash_undefined
|
|| h->type == bfd_link_hash_undefined
|
||||||
&& h->type != bfd_link_hash_common
|
|| (h->type == bfd_link_hash_defined
|
||||||
&& !(h->type == bfd_link_hash_defined
|
|
||||||
&& (h->u.def.section->flags
|
&& (h->u.def.section->flags
|
||||||
& SEC_LINKER_CREATED) != 0)))
|
& SEC_LINKER_CREATED) != 0)))
|
||||||
{
|
{
|
||||||
/* Do nothing. The symbol was never referenced, or was
|
/* Do nothing. The symbol was never referenced, or
|
||||||
defined by some object. */
|
was defined in some object file. Undefined weak
|
||||||
|
symbols stay undefined. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2014-12-23 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* ld-elf/endsym.s, *ld-elf/endsym.d: New test.
|
||||||
|
|
||||||
2014-12-19 Matthew Fortune <matthew.fortune@imgtec.com>
|
2014-12-19 Matthew Fortune <matthew.fortune@imgtec.com>
|
||||||
|
|
||||||
* ld-mips-elf/attr-gnu-4-00.d: Relax check for ISA extension.
|
* ld-mips-elf/attr-gnu-4-00.d: Relax check for ISA extension.
|
||||||
|
13
ld/testsuite/ld-elf/endsym.d
Normal file
13
ld/testsuite/ld-elf/endsym.d
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#source: start.s
|
||||||
|
#source: endsym.s
|
||||||
|
#ld: --sort-common
|
||||||
|
#nm: -n
|
||||||
|
#notarget: hppa*-*-hpux*
|
||||||
|
|
||||||
|
#...
|
||||||
|
.* end
|
||||||
|
#...
|
||||||
|
.* end2
|
||||||
|
#...
|
||||||
|
.* _?_end
|
||||||
|
#pass
|
2
ld/testsuite/ld-elf/endsym.s
Normal file
2
ld/testsuite/ld-elf/endsym.s
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.comm end,4,4
|
||||||
|
.comm end2,2,2
|
Reference in New Issue
Block a user