From 05906ac72f0f047472989a99dec1e66713157629 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 13 Feb 2012 18:08:50 +0000 Subject: [PATCH] PR ld/13621 bfd/ * linker.c (fix_syms): Force symbols outside any section into bfd_abs_section_ptr. ld/testsuite/ * ld-elf/warn2.d: Expect ABS section for Foo. * ld-elf/zerosize1.d, zerosize1.s: New test. --- bfd/ChangeLog | 6 ++++++ bfd/linker.c | 6 ++++++ ld/testsuite/ChangeLog | 6 ++++++ ld/testsuite/ld-elf/warn2.d | 2 +- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 490120baa..0a53fad02 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2012-02-13 Richard Henderson + + PR ld/13621 + * linker.c (fix_syms): Force symbols outside any section into + bfd_abs_section_ptr. + 2012-02-13 Alan Modra * elf32-m68hc1x.c (elf32_m68hc11_merge_symbol_attribute): New function. diff --git a/bfd/linker.c b/bfd/linker.c index c51c5df93..04044743f 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -3208,6 +3208,12 @@ fix_syms (struct bfd_link_hash_entry *h, void *data) op = op1; } + /* Refuse to choose a section for which we are out of bounds. */ + /* ??? This may make most of the above moot. */ + if (h->u.def.value < op->vma + || h->u.def.value > op->vma + op->size) + op = bfd_abs_section_ptr; + h->u.def.value -= op->vma; h->u.def.section = op; } diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index f1c82a066..f118153e3 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-02-13 Richard Henderson + + PR ld/13621 + * ld-elf/warn2.d: Expect ABS section for Foo. + * ld-elf/zerosize1.d, zerosize1.s: New test. + 2012-02-13 Alan Modra * ld-m68hc11/m68hc11.exp: Run for m68hc11-*-* and m68hc12-*-*. diff --git a/ld/testsuite/ld-elf/warn2.d b/ld/testsuite/ld-elf/warn2.d index 95b7ef499..a9c05f954 100644 --- a/ld/testsuite/ld-elf/warn2.d +++ b/ld/testsuite/ld-elf/warn2.d @@ -13,5 +13,5 @@ # construct and that the symbol still appears as expected. #... - +[0-9]+: +[0-9a-f]+ +20 +OBJECT +GLOBAL +DEFAULT +[1-9] Foo + +[0-9]+: +[0-9a-f]+ +20 +OBJECT +GLOBAL +DEFAULT +ABS Foo #pass -- 2.11.4.GIT