From 7a15a226ada5d390e119d5b4e8eb376e2d5c3d8d Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 15 Apr 1996 16:28:19 +0000 Subject: [PATCH] * config/tc-mips.c (load_address): Cast X_add_number to valueT before comparing against MAX_GPREL_OFFSET, so that negative numbers are handled correctly. (macro): Likewise. --- gas/ChangeLog | 7 +++++++ gas/config/tc-mips.c | 11 ++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 520ea708f03..d6f0815a81e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +Mon Apr 15 12:26:33 1996 Ian Lance Taylor + + * config/tc-mips.c (load_address): Cast X_add_number to valueT + before comparing against MAX_GPREL_OFFSET, so that negative + numbers are handled correctly. + (macro): Likewise. + Thu Apr 11 12:39:02 1996 Ian Lance Taylor * config/tc-sparc.c (last_insn): New static variable. diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 19b271dc4da..61f38dc729e 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -1993,7 +1993,8 @@ load_address (counter, reg, ep) lui $reg, (BFD_RELOC_HI16_S) addiu $reg,$reg, (BFD_RELOC_LO16) If we have an addend, we always use the latter form. */ - if (ep->X_add_number != 0 || nopic_need_relax (ep->X_add_symbol)) + if ((valueT) ep->X_add_number >= MAX_GPREL_OFFSET + || nopic_need_relax (ep->X_add_symbol)) p = NULL; else { @@ -2860,7 +2861,7 @@ macro (ip) addiu $tempreg,$tempreg, (BFD_RELOC_LO16) If we have a constant, we need two instructions anyhow, so we may as well always use the latter form. */ - if (offset_expr.X_add_number != 0 + if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET || nopic_need_relax (offset_expr.X_add_symbol)) p = NULL; else @@ -3571,7 +3572,7 @@ macro (ip) With a constant we always use the latter case. */ if (breg == 0) { - if (offset_expr.X_add_number != 0 + if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET || nopic_need_relax (offset_expr.X_add_symbol)) p = NULL; else @@ -3595,7 +3596,7 @@ macro (ip) } else { - if (offset_expr.X_add_number != 0 + if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET || nopic_need_relax (offset_expr.X_add_symbol)) p = NULL; else @@ -4000,7 +4001,7 @@ macro (ip) If there is a base register, we add it to $at after the lui instruction. If there is a constant, we always use the last case. */ - if (offset_expr.X_add_number != 0 + if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET || nopic_need_relax (offset_expr.X_add_symbol)) { p = NULL; -- 2.30.2