This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
VAX PC RELATIVE JMP: gas and gdb perform incorrect sign extension
- To: binutils at sourceware dot cygnus dot com, gdb at sourceware dot cygnus dot com
- Subject: VAX PC RELATIVE JMP: gas and gdb perform incorrect sign extension
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Mon, 21 Aug 2000 14:58:06 -0400 (EDT)
In trying to build the current cvs version of gcc, I discovered an
obviously long standing bug in the treatment of long pc relative
branches on the vax. The following code snippet from expand_expr
is incorrectly assembled by gas:
tstl r9
jeql L2956
clrl -(sp)
L2956 is more than 32K bytes back in the code. After linking, I
see the following with adb:
tstl r9
bneq 0xb4f06
jmp 0xbf867 ; wrong location
0xb4f06: clrl -(sp)
The `jmp' actually goes to 0xbf867, so I believe the adb disassembly.
However, when I look with gdb, I get:
tstl r9
bneq 0xb4f06
jmp 0xaf867 ; location of L2956
0xb4f06: clrl -(sp)
The hex value of the pc relative address is 0xa961 (0xb4f06 + 0xa961 =
0xbf867). However, gas and gdb seem to think that the vax will sign
extend the word 0xa961 to the long word 0xffffa961 (0xb4f06 + 0xffffa961 =
0xaf867). This is clearly wrong. The correct offset is 0xffffa961.
The error is present in expr.o, so it is not the linker which causes it.
I am looking at the binutils code. Suggestions on where to look are welcome.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)