From 6d633fd2827c7c46c05c45b75781ca8ab6a9afce Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 25 Apr 2005 14:59:09 +0000 Subject: [PATCH] bfd/ 2005-04-25 H.J. Lu PR 858 * elflink.c (elf_link_input_bfd): Make non-debugging reference to discarded section an error. ld/testsuite/ 2005-04-25 H.J. Lu * ld-discard/extern.d: Expect error. * ld-discard/start.d: Likewise. * ld-discard/static.d: Likewise. --- bfd/ChangeLog | 6 ++++++ bfd/elflink.c | 2 ++ ld/testsuite/ChangeLog | 6 ++++++ ld/testsuite/ld-discard/extern.d | 2 +- ld/testsuite/ld-discard/start.d | 2 +- ld/testsuite/ld-discard/static.d | 2 +- 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5e9f707685d..9d8e077f425 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2005-04-25 H.J. Lu + + PR 858 + * elflink.c (elf_link_input_bfd): Make non-debugging reference + to discarded section an error. + 2005-04-21 Jerome Guitton * configure.in: Replace BFD_NEED_DECLARATION checks by the diff --git a/bfd/elflink.c b/bfd/elflink.c index 017ebe436a9..cd9131ef380 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -7048,6 +7048,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) (_("`%s' referenced in section `%A' of %B: " "defined in discarded section `%A' of %B"), o, input_bfd, sec, sec->owner, sym_name); + bfd_set_error (bfd_error_bad_value); + return FALSE; } /* Try to do the best we can to support buggy old diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index f1fbcb922f0..355d97fc20e 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2005-04-25 H.J. Lu + + * ld-discard/extern.d: Expect error. + * ld-discard/start.d: Likewise. + * ld-discard/static.d: Likewise. + 2005-04-19 Alan Modra * ld-powerpc/reloc.d: Update to suit removal of non-alloc relocs. diff --git a/ld/testsuite/ld-discard/extern.d b/ld/testsuite/ld-discard/extern.d index e5143cb94c7..903379209bd 100644 --- a/ld/testsuite/ld-discard/extern.d +++ b/ld/testsuite/ld-discard/extern.d @@ -1,6 +1,6 @@ #source: extern.s #ld: -T discard.ld -#warning: .*data.* referenced in section `\.text' of tmpdir/dump0.o: defined in discarded section `\.data\.exit' of tmpdir/dump0.o +#error: .*data.* referenced in section `\.text' of tmpdir/dump0.o: defined in discarded section `\.data\.exit' of tmpdir/dump0.o #objdump: -p #pass # The expected warning used to start with "`data' referenced..." but diff --git a/ld/testsuite/ld-discard/start.d b/ld/testsuite/ld-discard/start.d index 2ad6e9f00c6..5c685e81041 100644 --- a/ld/testsuite/ld-discard/start.d +++ b/ld/testsuite/ld-discard/start.d @@ -1,6 +1,6 @@ #source: start.s #source: exit.s #ld: -T discard.ld -#warning: `data' referenced in section `\.text' of tmpdir/dump0.o: defined in discarded section `\.data\.exit' of tmpdir/dump1.o +#error: `data' referenced in section `\.text' of tmpdir/dump0.o: defined in discarded section `\.data\.exit' of tmpdir/dump1.o #objdump: -p #pass diff --git a/ld/testsuite/ld-discard/static.d b/ld/testsuite/ld-discard/static.d index eefeeea65de..3b5255bce3a 100644 --- a/ld/testsuite/ld-discard/static.d +++ b/ld/testsuite/ld-discard/static.d @@ -1,5 +1,5 @@ #source: static.s #ld: -T discard.ld -#warning: `(\.data\.exit|data)' referenced in section `\.text' of tmpdir/dump0.o: defined in discarded section `\.data\.exit' of tmpdir/dump0.o +#error: `(\.data\.exit|data)' referenced in section `\.text' of tmpdir/dump0.o: defined in discarded section `\.data\.exit' of tmpdir/dump0.o #objdump: -p #pass -- 2.30.2