public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [RFA] pdp11: allow references to abs addresses with pc-relative addressing mode
@ 2010-12-31 17:25 Paul Koning
  2011-01-06 10:29 ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Koning @ 2010-12-31 17:25 UTC (permalink / raw)
  To: binutils

Currently the pdp11 assembler rejects pc-relative addressing mode if the operand is an absolute address (numeric address or symbol equated to a number).  Those are fine on a pdp11 and the relocation machinery handles them fine.  They pop up occasionally in compiler output, resulting in errors at the assembly stage.

The attached patch fixes this by deleting the code that rejects such operands.

Tested by building pdp11-aout-none and running the gcc testsuite (compile only) that turns up these errors, and checking the resulting a.out.

Ok to commit?

	paul

ChangeLog:

2010-12-31  Paul Koning  <ni1d@arrl.net>

	* config/tc-pdp11.c (parse_op_no_deferred): Allow PC-relative
	references to absolute addresses.

Index: tc-pdp11.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-pdp11.c,v
retrieving revision 1.23
diff -u -r1.23 tc-pdp11.c
--- tc-pdp11.c	29 Aug 2009 22:10:59 -0000	1.23
+++ tc-pdp11.c	31 Dec 2010 17:18:42 -0000
@@ -501,8 +501,6 @@
       /* label, d(rn), -(rn)  */
     default:
       {
-	char *old = str;
-
 	if (strncmp (str, "-(", 2) == 0)	/* -(rn) */
 	  {
 	    str = parse_reg (str + 2, operand);
@@ -527,11 +525,6 @@
 
 	if (*str != '(')
 	  {
-	    if (operand->reloc.exp.X_op != O_symbol)
-	      {
-		operand->error = _("Label expected");
-		return old;
-	      }
 	    operand->code = 067;
 	    operand->additional = 1;
 	    operand->word = 0;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] pdp11: allow references to abs addresses with pc-relative addressing mode
  2010-12-31 17:25 [RFA] pdp11: allow references to abs addresses with pc-relative addressing mode Paul Koning
@ 2011-01-06 10:29 ` Nick Clifton
  2011-01-06 16:43   ` Paul Koning
  2011-01-07  1:51   ` Paul Koning
  0 siblings, 2 replies; 4+ messages in thread
From: Nick Clifton @ 2011-01-06 10:29 UTC (permalink / raw)
  To: Paul Koning; +Cc: binutils

Hi Paul,

> 2010-12-31  Paul Koning<ni1d@arrl.net>
>
> 	* config/tc-pdp11.c (parse_op_no_deferred): Allow PC-relative
> 	references to absolute addresses.

Approved - please apply - but please also add a testcase to the gas 
testsuite to check that the new support continues to work.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] pdp11: allow references to abs addresses with pc-relative addressing mode
  2011-01-06 10:29 ` Nick Clifton
@ 2011-01-06 16:43   ` Paul Koning
  2011-01-07  1:51   ` Paul Koning
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Koning @ 2011-01-06 16:43 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils


On Jan 6, 2011, at 5:29 AM, Nick Clifton wrote:

> Hi Paul,
> 
>> 2010-12-31  Paul Koning<ni1d@arrl.net>
>> 
>> 	* config/tc-pdp11.c (parse_op_no_deferred): Allow PC-relative
>> 	references to absolute addresses.
> 
> Approved - please apply - but please also add a testcase to the gas testsuite to check that the new support continues to work.

Thanks.  Applied as follows.

	paul

ChangeLog:

2011-01-06  Paul Koning  <ni1d@arrl.net>

	* config/tc-pdp11.c (parse_op_no_deferred): Allow PC-relative
	references to absolute addresses.

testsuite/ChangeLog:

2011-01-06  Paul Koning  <ni1d@arrl.net>

	* gas/pdp11/absreloc.s: New.
	* gas/pdp11/absreloc.d: New.

Index: config/tc-pdp11.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-pdp11.c,v
retrieving revision 1.23
diff -u -r1.23 tc-pdp11.c
--- config/tc-pdp11.c	29 Aug 2009 22:10:59 -0000	1.23
+++ config/tc-pdp11.c	6 Jan 2011 16:37:56 -0000
@@ -501,8 +501,6 @@
       /* label, d(rn), -(rn)  */
     default:
       {
-	char *old = str;
-
 	if (strncmp (str, "-(", 2) == 0)	/* -(rn) */
 	  {
 	    str = parse_reg (str + 2, operand);
@@ -527,11 +525,6 @@
 
 	if (*str != '(')
 	  {
-	    if (operand->reloc.exp.X_op != O_symbol)
-	      {
-		operand->error = _("Label expected");
-		return old;
-	      }
 	    operand->code = 067;
 	    operand->additional = 1;
 	    operand->word = 0;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFA] pdp11: allow references to abs addresses with pc-relative addressing mode
  2011-01-06 10:29 ` Nick Clifton
  2011-01-06 16:43   ` Paul Koning
@ 2011-01-07  1:51   ` Paul Koning
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Koning @ 2011-01-07  1:51 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

> 
>> 2010-12-31  Paul Koning<ni1d@arrl.net>
>> 
>> 	* config/tc-pdp11.c (parse_op_no_deferred): Allow PC-relative
>> 	references to absolute addresses.
> 

I missed the change of pdp11.exp when I checked this in.  Fixed with a followup checkin to gas/testsuite:

	paul

ChangeLog:

2011-01-06  Paul Koning  <ni1d@arrl.net>

	* gas/pdp11/pdp11.exp: Add run of absreloc.

Index: gas/pdp11/pdp11.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/pdp11/pdp11.exp,v
retrieving revision 1.2
diff -u -r1.2 pdp11.exp
--- gas/pdp11/pdp11.exp	5 Jun 2007 17:00:32 -0000	1.2
+++ gas/pdp11/pdp11.exp	7 Jan 2011 01:50:12 -0000
@@ -5,5 +5,6 @@
 if [expr [istarget "pdp11-*-*"]]  then {
 
     run_dump_test "opcode"
+    run_dump_test "absreloc"
 
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-07  1:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-31 17:25 [RFA] pdp11: allow references to abs addresses with pc-relative addressing mode Paul Koning
2011-01-06 10:29 ` Nick Clifton
2011-01-06 16:43   ` Paul Koning
2011-01-07  1:51   ` Paul Koning

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).