[RFA] Fix two tc-pdp11 internal errors
Paul Koning
paul_koning@dell.com
Fri Jan 14 17:33:00 GMT 2011
As pointed out by the testsuite failures Alan showed, gas for pdp11 was aborting when it encounters a 32-bit relocatable value. It should produce an error message instead.
Similarly, another internal error shows up when you ask for .quad -- which actually should work.
The attached patch cures both these errors. I have two new testcases to check the fixes.
Ok to commit to trunk?
paul
gas/ChangeLog:
2011-01-14 Paul Koning <ni1d@arrl.net>
* config/tc-pdp11.c (md_number_to_chars): Add support for 8 byte
value.
(md_apply_fix): Issue error message for unsupported relocations.
(tc_gen_reloc): Ditto.
gas/testsuite/ChangeLog:
2011-01-14 Paul Koning <ni1d@arrl.net>
* gas/pdp11/pdp11.exp: Add new tests pdp11-quad, pdp11-badreloc.
* gas/pdp11/pdp11-quad.s: New file.
* gas/pdp11/pdp11-quad.d: New file.
* gas/pdp11/pdp11-badreloc.s: New file.
Index: gas/config/tc-pdp11.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-pdp11.c,v
retrieving revision 1.24
diff -u -r1.24 tc-pdp11.c
--- gas/config/tc-pdp11.c 6 Jan 2011 16:40:13 -0000 1.24
+++ gas/config/tc-pdp11.c 14 Jan 2011 17:19:03 -0000
@@ -223,6 +223,16 @@
con[2] = value & 0xff;
con[3] = (value >> 8) & 0xff;
break;
+ case 8:
+ con[0] = (value >> 48) & 0xff;
+ con[1] = (value >> 56) & 0xff;
+ con[2] = (value >> 32) & 0xff;
+ con[3] = (value >> 40) & 0xff;
+ con[4] = (value >> 16) & 0xff;
+ con[5] = (value >> 24) & 0xff;
+ con[6] = value & 0xff;
+ con[7] = (value >> 8) & 0xff;
+ break;
default:
BAD_CASE (nbytes);
}
@@ -245,7 +255,6 @@
buf = fixP->fx_where + fixP->fx_frag->fr_literal;
size = fixP->fx_size;
- code = md_chars_to_number ((unsigned char *) buf, size);
switch (fixP->fx_r_type)
{
@@ -264,9 +273,14 @@
val = -val;
break;
default:
- BAD_CASE (fixP->fx_r_type);
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("Can not represent %s relocation in this object file format"),
+ bfd_get_reloc_code_name (fixP->fx_r_type));
+ return;
}
+ code = md_chars_to_number ((unsigned char *) buf, size);
+
if (fixP->fx_addsy != NULL)
val += symbol_get_bfdsym (fixP->fx_addsy)->section->vma;
/* *value += fixP->fx_addsy->bsym->section->vma; */
@@ -1412,7 +1426,9 @@
break;
default:
- BAD_CASE (fixp->fx_r_type);
+ as_bad_where (fixp->fx_file, fixp->fx_line,
+ _("Can not represent %s relocation in this object file format"),
+ bfd_get_reloc_code_name (fixp->fx_r_type));
return NULL;
}
Index: gas/testsuite/gas/pdp11/pdp11.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/pdp11/pdp11.exp,v
retrieving revision 1.3
diff -u -r1.3 pdp11.exp
--- gas/testsuite/gas/pdp11/pdp11.exp 7 Jan 2011 01:51:45 -0000 1.3
+++ gas/testsuite/gas/pdp11/pdp11.exp 14 Jan 2011 17:19:03 -0000
@@ -6,5 +6,6 @@
run_dump_test "opcode"
run_dump_test "absreloc"
-
+ run_dump_test "pdp11-quad"
+ gas_test_error "pdp11-badreloc.s" "" "relocatable .long not valid on pdp11"
}
New file gas/testsuite/gas/pdp11/pdp11-quad.s:
.long 01122334455
.quad 0x1122334455667788
New file gas/testsuite/gas/pdp11/pdp11-quad.d:
#name: pdp11 long/quad
#objdump: -s
dump.o: +file format .*
Contents of section \.text:
0000 49092db9 22114433 66558877 I\.-\.\"\.D3fU\.w
New file gas/testsuite/gas/pdp11/pdp11-badreloc.s:
.long foo
.quad bar
More information about the Binutils
mailing list