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]

[RFA:] Change assertion to ordinary code in aout_link_add_symbols


I got things wrong at first; I noticed that the warning
construct came out wrong from GAS, but didn't notice that the
SEGV was due to another bug (see previous patch to aoutx.h).  I
thought that somehow the warning symbol was at the end of the
object, but when I made a test-case to match, I noticed that was
wrong but that BFD didn't handle a split-up warning construct
*either* (it's one stabs directive immediately followed by a
symbol definition; see libgloss/libnosys/warning.h).  You get
this assertion for the test-case:
./ld-new: BFD 2.15.94 20050203 assertion fail /h/hp/binutils/cvs_latest/src/bfd/aoutx.h:3434

So here's a test-case or four and a patch to handle that as
well; the construct is invalid and perhaps GAS should warn or
error, but then again, keeping it silent, ignoring the partial
directive, works for me.  The def2 and def3 cases are just tests
that put together the partial warning construct with the
previous test-cases to see that it links as expected.

This patch is fairly independent of the other changes.
Ok for the aoutx.h patch below?

ld/testsuite:
	* ld-cris/globsymw1.s, ld-cris/glob1ref.s: New files.
	* ld-cris/warn1.d, ld-cris/warn2.d, ld-cris/def2.d,
	ld-cris/def3.d: New tests.

--- /dev/null	Tue Oct 29 15:57:07 2002
+++ ld-cris/warn1.d	Fri Feb  4 02:22:29 2005
@@ -0,0 +1,11 @@
+#source: start1.s
+#source: globsym1ref.s
+#source: globsymw1.s
+#target: cris-*-*elf* cris-*-*aout*
+#as: --em=crisaout
+#ld: -mcrisaout
+#objdump: -p
+# There should be no warning, since the symbol warned about is
+# missing from the construct.
+.*:     file format a\.out-cris
+#pass
--- /dev/null	Tue Oct 29 15:57:07 2002
+++ ld-cris/warn2.d	Fri Feb  4 02:01:36 2005
@@ -0,0 +1,11 @@
+#source: start1.s
+#source: globsym1ref.s
+#source: globsymw1.s
+#target: cris-*-*elf* cris-*-*aout*
+#as: --em=criself
+#ld: -mcriself
+#objdump: -p
+# There should be no warning, since the symbol warned about is
+# missing from the construct.
+.*:     file format elf32.*-cris
+#pass
--- /dev/null	Tue Oct 29 15:57:07 2002
+++ ld-cris/globsym1ref.s	Thu Feb  3 15:00:01 2005
@@ -0,0 +1 @@
+ .long globsym1
--- /dev/null	Tue Oct 29 15:57:07 2002
+++ ld-cris/globsymw1.s	Thu Feb  3 15:31:14 2005
@@ -0,0 +1,15 @@
+	.text
+	.stabn	162,0,0,0
+	.global globsym1
+	.type	globsym1, @function
+globsym1:
+	.stabd	46,0,0
+	.stabn	68,0,16,LM0-globsym1
+LM0:
+	.long 0
+	.size	globsym1, .-globsym1
+	.stabs	"",100,0,0,Letext0
+Letext0:
+;# This must be the last line; the point is that the warning symbol
+;# construct is last, but is missing the actual symbol warned about.
+	.stabs "isatty is not implemented and will always fail",30,0,0,0
--- /dev/null	Tue Oct 29 15:57:07 2002
+++ ld-cris/def2.d	Fri Feb  4 02:01:11 2005
@@ -0,0 +1,10 @@
+#source: start1.s
+#source: stabs1.s
+#source: globsymw1.s
+#target: cris-*-*elf* cris-*-*aout*
+#as: --em=crisaout
+#ld: -mcrisaout
+#objdump: -p
+# Just checking that undef2 links correctly when given a symbol.
+.*:     file format a\.out-cris
+#pass
--- /dev/null	Tue Oct 29 15:57:07 2002
+++ ld-cris/def3.d	Fri Feb  4 02:17:41 2005
@@ -0,0 +1,10 @@
+#source: start1.s
+#source: stabs1.s
+#source: globsymw1.s
+#target: cris-*-*elf* cris-*-*aout*
+#as: --em=criself
+#ld: -mcriself
+#objdump: -p
+# Just checking that undef3 links correctly when given a symbol.
+.*:     file format elf32.*-cris
+#pass

bfd:
	* aoutx.h (aout_link_add_symbols): Just return TRUE if a warning
	symbol was last.

--- aoutx.h.warn1	Fri Feb  4 02:00:23 2005
+++ aoutx.h	Fri Feb  4 02:27:51 2005
@@ -3430,8 +3430,9 @@ aout_link_add_symbols (abfd, info)
 	  break;
 	case N_WARNING:
 	  /* A warning symbol.  The next symbol is the one to warn
-	     about.  */
-	  BFD_ASSERT (p + 1 < pend);
+	     about.  If there is no next symbol, just look away.  */
+	  if (p + 1 >= pend)
+	    return TRUE;
 	  ++p;
 	  string = name;
 	  name = strings + GET_WORD (abfd, p->e_strx);

brgds, H-P


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