Correct the relative jump calculation.

This commit is contained in:
Nick Clifton 2005-02-07 16:00:10 +00:00
parent 992771964f
commit 9f5083a4b6
7 changed files with 63 additions and 45 deletions

View file

@ -1,3 +1,10 @@
2005-02-07 Inderpreet Singh <inderpreetb@noida.hcltech.com>
* config/tc-maxq.c (md_estimate_size_before_relax): Correct the
relative jump calculation.
<md_convert_frag) : Likewise.
<output_disp): Likewise.
2005-02-07 Hans-Peter Nilsson <hp@axis.com>
* write.c (write_object_file): Recognize warning-symbol construct

View file

@ -376,7 +376,9 @@ md_estimate_size_before_relax (fragS *fragP, segT segment)
/* This is the offset if it is a PC relative jump. */
call_addr = S_GET_VALUE (fragP->fr_symbol) + fragP->fr_offset;
diff = (call_addr - instr);
/* PC stores the value of the next instruction. */
diff = (call_addr - instr) - 1;
if (diff >= (-128 * 2) && diff <= (2 * 127))
{
@ -510,7 +512,8 @@ md_convert_frag (object_headers * headers ATTRIBUTE_UNUSED,
(fragP->fr_address / MAXQ_OCTETS_PER_BYTE) +
((fragP->fr_fix - 2) / MAXQ_OCTETS_PER_BYTE);
displacement_from_opcode_start = (target_address - opcode_address);
/* PC points to the next Instruction. */
displacement_from_opcode_start = ((target_address - opcode_address) - 1);
if ((displacement_from_opcode_start >= -128
&& displacement_from_opcode_start <= 127)
@ -2766,7 +2769,8 @@ output_disp (fragS *insn_start_frag, offsetT insn_start_off)
((((expressionS *) symbol_get_value_expression (sym))->
X_add_number) - insn_start_off);
diff = diff / MAXQ_OCTETS_PER_BYTE;
/* PC points to the next instruction. */
diff = (diff / MAXQ_OCTETS_PER_BYTE) - 1;
if (diff >= -128 && diff <= 127)
{

View file

@ -1,3 +1,10 @@
2005-02-07 Inderpreet Singh <inderpreetb@noida.hcltech.com>
* gas/maxq10/jump.d: Fixed relative jump offset.
* gas/maxq10/call.d: Likewise.
* gas/maxq20/jump.d: Likewise.
* gas/maxq20/call.d: Likewise.
2005-02-07 Hans-Peter Nilsson <hp@axis.com>
* lib/gas-defs.exp: Support new directive "warning".

View file

@ -5,7 +5,7 @@
Disassembly of section .text:
0+000 <foo>:
0: 03 3d [ ]*CALL #03h
0: 02 3d [ ]*CALL #02h
2: 04 0b [ ]*MOVE PFX\[0\], #04h
4: 28 3d [ ]*CALL #28h
0+6 <SmallCall>:
@ -21,11 +21,11 @@ Disassembly of section .text:
18: 8d cc [ ]*RETI S
1a: 10 7d [ ]*MOVE LC\[1\], #10h
0+1c <LoopTop>:
1c: 00 3d [ ]*CALL #00h
1e: ff 5d [ ]*DJNZ LC\[1\], #ffh
1c: ff 3d [ ]*CALL #ffh
1e: fe 5d [ ]*DJNZ LC\[1\], #feh
20: 10 7d [ ]*MOVE LC\[1\], #10h
0+22 <LoopTop1>:
22: 00 3d [ ]*CALL #00h
22: ff 3d [ ]*CALL #ffh
...
424: 00 0b [ ]*MOVE PFX\[0\], #00h
426: 1c 5d [ ]*DJNZ LC\[1\], #1ch

View file

@ -5,45 +5,45 @@
Disassembly of section .text:
0+000 <LableStart>:
0: 00 0c [ ]*JUMP #00h
2: ff 2c [ ]*JUMP C , #ffh
0: ff 0c [ ]*JUMP #ffh
2: fe 2c [ ]*JUMP C , #feh
4: 09 ac [ ]*JUMP C , A\[0\]
6: 19 ac [ ]*JUMP C , A\[1\]
8: fc 6c [ ]*JUMP NC , #fch
8: fb 6c [ ]*JUMP NC , #fbh
a: 09 ec [ ]*JUMP NC , A\[0\]
c: 19 ec [ ]*JUMP NC , A\[1\]
e: f9 4c [ ]*JUMP S , #f9h
e: f8 4c [ ]*JUMP S , #f8h
10: 09 cc [ ]*JUMP S , A\[0\]
12: 19 cc [ ]*JUMP S , A\[1\]
14: f6 1c [ ]*JUMP Z , #f6h
14: f5 1c [ ]*JUMP Z , #f5h
16: 09 9c [ ]*JUMP Z , A\[0\]
18: 19 9c [ ]*JUMP Z , A\[1\]
1a: f3 5c [ ]*JUMP NZ , #f3h
1a: f2 5c [ ]*JUMP NZ , #f2h
1c: 09 dc [ ]*JUMP NZ , A\[0\]
1e: 19 dc [ ]*JUMP NZ , A\[1\]
20: f0 3c [ ]*JUMP E , #f0h
22: ef 7c [ ]*JUMP NE , #efh
24: 01 7c [ ]*JUMP NE , #01h
20: ef 3c [ ]*JUMP E , #efh
22: ee 7c [ ]*JUMP NE , #eeh
24: 00 7c [ ]*JUMP NE , #00h
0+026 <Lable1>:
26: 00 0c [ ]*JUMP #00h
28: ff 2c [ ]*JUMP C , #ffh
26: ff 0c [ ]*JUMP #ffh
28: fe 2c [ ]*JUMP C , #feh
2a: 09 ac [ ]*JUMP C , A\[0\]
2c: 19 ac [ ]*JUMP C , A\[1\]
2e: fc 6c [ ]*JUMP NC , #fch
2e: fb 6c [ ]*JUMP NC , #fbh
30: 09 ec [ ]*JUMP NC , A\[0\]
32: 19 ec [ ]*JUMP NC , A\[1\]
34: f9 4c [ ]*JUMP S , #f9h
34: f8 4c [ ]*JUMP S , #f8h
36: 09 cc [ ]*JUMP S , A\[0\]
38: 19 cc [ ]*JUMP S , A\[1\]
3a: f6 1c [ ]*JUMP Z , #f6h
3a: f5 1c [ ]*JUMP Z , #f5h
3c: 09 9c [ ]*JUMP Z , A\[0\]
3e: 19 9c [ ]*JUMP Z , A\[1\]
40: f3 5c [ ]*JUMP NZ , #f3h
40: f2 5c [ ]*JUMP NZ , #f2h
42: 09 dc [ ]*JUMP NZ , A\[0\]
44: 19 dc [ ]*JUMP NZ , A\[1\]
46: f0 3c [ ]*JUMP E , #f0h
48: ef 7c [ ]*JUMP NE , #efh
46: ef 3c [ ]*JUMP E , #efh
48: ee 7c [ ]*JUMP NE , #eeh
4a: 04 0b [ ]*MOVE PFX\[0\], #04h
4c: c6 0c [ ]*JUMP #c6h
4e: 04 0b [ ]*MOVE PFX\[0\], #04h

View file

@ -5,7 +5,7 @@
Disassembly of section .text:
0+000 <foo>:
0: 03 3d [ ]*CALL #03h
0: 02 3d [ ]*CALL #02h
2: 04 0b [ ]*MOVE PFX\[0\], #04h
4: 28 3d [ ]*CALL #28h
@ -23,12 +23,12 @@ Disassembly of section .text:
1a: 10 7d [ ]*MOVE LC\[1\], #10h
0+01c <LoopTop>:
1c: 00 3d [ ]*CALL #00h
1e: ff 5d [ ]*DJNZ LC\[1\], #ffh
1c: ff 3d [ ]*CALL #ffh
1e: fe 5d [ ]*DJNZ LC\[1\], #feh
20: 10 7d [ ]*MOVE LC\[1\], #10h
0+022 <LoopTop1>:
22: 00 3d [ ]*CALL #00h
22: ff 3d [ ]*CALL #ffh
...
424: 00 0b [ ]*MOVE PFX\[0\], #00h
426: 1c 5d [ ]*DJNZ LC\[1\], #1ch

View file

@ -5,45 +5,45 @@
Disassembly of section .text:
0+000 <LableStart>:
0: 00 0c [ ]*JUMP #00h
2: ff 2c [ ]*JUMP C , #ffh
0: ff 0c [ ]*JUMP #ffh
2: fe 2c [ ]*JUMP C , #feh
4: 09 ac [ ]*JUMP C , A\[0\]
6: 19 ac [ ]*JUMP C , A\[1\]
8: fc 6c [ ]*JUMP NC , #fch
8: fb 6c [ ]*JUMP NC , #fbh
a: 09 ec [ ]*JUMP NC , A\[0\]
c: 19 ec [ ]*JUMP NC , A\[1\]
e: f9 4c [ ]*JUMP S , #f9h
e: f8 4c [ ]*JUMP S , #f8h
10: 09 cc [ ]*JUMP S , A\[0\]
12: 19 cc [ ]*JUMP S , A\[1\]
14: f6 1c [ ]*JUMP Z , #f6h
14: f5 1c [ ]*JUMP Z , #f5h
16: 09 9c [ ]*JUMP Z , A\[0\]
18: 19 9c [ ]*JUMP Z , A\[1\]
1a: f3 5c [ ]*JUMP NZ , #f3h
1a: f2 5c [ ]*JUMP NZ , #f2h
1c: 09 dc [ ]*JUMP NZ , A\[0\]
1e: 19 dc [ ]*JUMP NZ , A\[1\]
20: f0 3c [ ]*JUMP E , #f0h
22: ef 7c [ ]*JUMP NE , #efh
24: 01 7c [ ]*JUMP NE , #01h
20: ef 3c [ ]*JUMP E , #efh
22: ee 7c [ ]*JUMP NE , #eeh
24: 00 7c [ ]*JUMP NE , #00h
0+026 <Lable1>:
26: 00 0c [ ]*JUMP #00h
28: ff 2c [ ]*JUMP C , #ffh
26: ff 0c [ ]*JUMP #ffh
28: fe 2c [ ]*JUMP C , #feh
2a: 09 ac [ ]*JUMP C , A\[0\]
2c: 19 ac [ ]*JUMP C , A\[1\]
2e: fc 6c [ ]*JUMP NC , #fch
2e: fb 6c [ ]*JUMP NC , #fbh
30: 09 ec [ ]*JUMP NC , A\[0\]
32: 19 ec [ ]*JUMP NC , A\[1\]
34: f9 4c [ ]*JUMP S , #f9h
34: f8 4c [ ]*JUMP S , #f8h
36: 09 cc [ ]*JUMP S , A\[0\]
38: 19 cc [ ]*JUMP S , A\[1\]
3a: f6 1c [ ]*JUMP Z , #f6h
3a: f5 1c [ ]*JUMP Z , #f5h
3c: 09 9c [ ]*JUMP Z , A\[0\]
3e: 19 9c [ ]*JUMP Z , A\[1\]
40: f3 5c [ ]*JUMP NZ , #f3h
40: f2 5c [ ]*JUMP NZ , #f2h
42: 09 dc [ ]*JUMP NZ , A\[0\]
44: 19 dc [ ]*JUMP NZ , A\[1\]
46: f0 3c [ ]*JUMP E , #f0h
48: ef 7c [ ]*JUMP NE , #efh
46: ef 3c [ ]*JUMP E , #efh
48: ee 7c [ ]*JUMP NE , #eeh
4a: 04 0b [ ]*MOVE PFX\[0\], #04h
4c: c6 0c [ ]*JUMP #c6h
4e: 04 0b [ ]*MOVE PFX\[0\], #04h