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]

Re: VAX PC RELATIVE JMP: gas and gdb perform incorrect sign extension


> On Mon, 21 Aug 2000, John David Anglin wrote:
> 
> > I am looking at the binutils code.  Suggestions on where to look are welcome.
> 
> I'm not particularly familiar with the vax port, but my guess would be a
> problem in tc-vax.c:md_convert_frag, or possibly md_estimate_size_before_relax

I believe the enclosed patch fixes the gas problem.  At least, a little test
program was assembled correctly.  Tests all pass as before.

The gdb disassembly problem may go away if I build the current version since
objdump disassembles my test program successfully.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2000-08-22  J. David Anglin  <dave@hiauly1.hia.nrc.ca>

	* tc-vax.c (md_convert_frag): Correctly calculate the pc relative
	offset of the target destination for jmp instructions.
	(md_assemble): Change mode to VAX_ABSOLUTE_MODE as per comments.

--- tc-vax.c.orig	Tue Jun 27 11:38:56 2000
+++ tc-vax.c	Tue Aug 22 13:13:42 2000
@@ -775,7 +775,7 @@
 				  p[1] = VAX_BRB;
 				  p[2] = 6;
 				  p[3] = VAX_JMP;
-				  p[4] = VAX_PC_RELATIVE_MODE + 1;	/* @#... */
+				  p[4] = VAX_ABSOLUTE_MODE;	/* @#... */
 				  md_number_to_chars (p + 5, this_add_number, 4);
 				  /*
 				   * Now (eg)	xOBxxx	1f
@@ -1349,7 +1349,7 @@
       addressP[0] = 6;
       addressP[1] = VAX_JMP;
       addressP[2] = VAX_PC_RELATIVE_MODE;
-      md_number_to_chars (addressP + 3, target_address, 4);
+      md_number_to_chars (addressP + 3, target_address - (address_of_var + 7), 4);
       extension = 7;
       break;
 
@@ -1383,7 +1383,7 @@
       addressP[3] = 6;
       addressP[4] = VAX_JMP;
       addressP[5] = VAX_PC_RELATIVE_MODE;
-      md_number_to_chars (addressP + 6, target_address, 4);
+      md_number_to_chars (addressP + 6, target_address - (address_of_var + 10), 4);
       extension = 10;
       break;
 
@@ -1407,7 +1407,7 @@
       addressP[2] = 6;
       addressP[3] = VAX_JMP;
       addressP[4] = VAX_PC_RELATIVE_MODE;
-      md_number_to_chars (addressP + 5, target_address, 4);
+      md_number_to_chars (addressP + 5, target_address - (address_of_var + 9), 4);
       extension = 9;
       break;
 

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