diff options
author | Nick Clifton <nickc@redhat.com> | 2005-02-07 16:00:10 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2005-02-07 16:00:10 +0000 |
commit | 9f5083a4b6161bb345cc54f7bd484725316fb1e2 (patch) | |
tree | 48a8c12f5a68a01a15b7e9fc4bf97fc6b09ba124 /gas/config | |
parent | 992771964fc2b57468be0b4e4aa13a282d0a8c4a (diff) | |
download | gdb-9f5083a4b6161bb345cc54f7bd484725316fb1e2.zip gdb-9f5083a4b6161bb345cc54f7bd484725316fb1e2.tar.gz gdb-9f5083a4b6161bb345cc54f7bd484725316fb1e2.tar.bz2 |
Correct the relative jump calculation.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-maxq.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gas/config/tc-maxq.c b/gas/config/tc-maxq.c index 43784c9..dda7ca4 100644 --- a/gas/config/tc-maxq.c +++ b/gas/config/tc-maxq.c @@ -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) { |