You should have received a copy of the GNU General Public License along
with GAS; see the file COPYING. If not, write to the Free Software
- Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "as.h"
#include "safe-ctype.h"
/* 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))
{
fragS * fragP)
#endif
{
- unsigned char *opcode;
+ char *opcode;
offsetT target_address;
offsetT opcode_address;
offsetT displacement_from_opcode_start;
(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)
|| fragP->fr_subtype == NO_PREFIX))
{
/* Its a displacement. */
- char *p = (char *) &opcode[0];
-
- *p = (char) displacement_from_opcode_start;
+ *opcode = (char) displacement_from_opcode_start;
}
else
{
if (fragP->fr_subtype != SHORT_PREFIX)
{
RELOC_ENUM reloc_type;
- unsigned char *opcode;
int old_fr_fix;
int size = 2;
if (reloc_type == 1)
size = 0;
old_fr_fix = fragP->fr_fix;
- opcode = (unsigned char *) fragP->fr_opcode;
fragP->fr_fix += (size);
/* GAS will call this for each fixup. It's main objective is to store the
correct value in the object file. 'fixup_segment' performs the generic
- overflow check on the 'valueT *val' argument after md_apply_fix3 returns.
+ overflow check on the 'valueT *val' argument after md_apply_fix returns.
If the overflow check is relevant for the target machine, then
- 'md_apply_fix3' should modify 'valueT *val', typically to the value stored
+ 'md_apply_fix' should modify 'valueT *val', typically to the value stored
in the object file (not to be done in MAXQ). */
void
-md_apply_fix3 (fixS *fixP, valueT *valT, segT seg ATTRIBUTE_UNUSED)
+md_apply_fix (fixS *fixP, valueT *valT, segT seg ATTRIBUTE_UNUSED)
{
char *p = fixP->fx_frag->fr_literal + fixP->fx_where;
char *frag_to_fix_at =
((((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)
{