This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR 858: Linker should abort when there is reference to discarded section


This patch makes linker abort when there is reference to iscarded
section.


H.J.
----
bfd/

2005-04-22  H.J. Lu  <hongjiu.lu@intel.com>

	PR 858
	* elflink.c (elf_link_input_bfd): Make non-debugging reference
	to discarded section an error.

ld/testsuite/

2005-04-22  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-discard/extern.d: Expect error.
	* ld-discard/start.d: Likewise.
	* ld-discard/static.d: Likewise.

--- binutils/bfd/elflink.c.discard	2005-04-22 10:03:12.000000000 -0700
+++ binutils/bfd/elflink.c	2005-04-22 10:27:38.000000000 -0700
@@ -7075,6 +7075,8 @@ elf_link_input_bfd (struct elf_final_lin
 			    (_("`%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
--- binutils/ld/testsuite/ld-discard/extern.d.discard	2005-03-01 12:52:09.000000000 -0800
+++ binutils/ld/testsuite/ld-discard/extern.d	2005-04-22 10:33:43.000000000 -0700
@@ -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
--- binutils/ld/testsuite/ld-discard/start.d.discard	2005-02-11 09:28:26.000000000 -0800
+++ binutils/ld/testsuite/ld-discard/start.d	2005-04-22 10:33:53.000000000 -0700
@@ -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
--- binutils/ld/testsuite/ld-discard/static.d.discard	2005-02-11 09:28:26.000000000 -0800
+++ binutils/ld/testsuite/ld-discard/static.d	2005-04-22 10:33:58.000000000 -0700
@@ -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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]