* tc_mips.h (MAX_GPREL_OFFSET): Change it to the maximum allowed

value, not the word beyond maximum.
	* tc_mips.c (macro_build_lui): Code cleanup.
	(macro): Reflect change to MAX_GPREL_OFFSET.
	(mips_ip): Check explicitly against S_EX_NONE.
	(my_get_SmallExpression): parse for %gp_rel, not %gprel.
	(md_apply_fix): Code cleanup.
This commit is contained in:
Thiemo Seufer
2001-08-26 10:42:12 +00:00
parent b92b9cfe73
commit e7d556dfef
3 changed files with 24 additions and 17 deletions

View File

@ -1,3 +1,13 @@
2001-08-26 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* tc_mips.h (MAX_GPREL_OFFSET): Change it to the maximum allowed
value, not the word beyond maximum.
* tc_mips.c (macro_build_lui): Code cleanup.
(macro): Reflect change to MAX_GPREL_OFFSET.
(mips_ip): Check explicitly against S_EX_NONE.
(my_get_SmallExpression): parse for %gp_rel, not %gprel.
(md_apply_fix): Code cleanup.
2001-08-24 Andreas Jaeger <aj@suse.de> 2001-08-24 Andreas Jaeger <aj@suse.de>
* config/tc-ppc.h: Fix prototype declaration. * config/tc-ppc.h: Fix prototype declaration.

View File

@ -2877,10 +2877,8 @@ macro_build_lui (place, counter, ep, regnum)
if (high_expr.X_op == O_constant) if (high_expr.X_op == O_constant)
{ {
/* we can compute the instruction now without a relocation entry */ /* we can compute the instruction now without a relocation entry */
if (high_expr.X_add_number & 0x8000) high_expr.X_add_number = ((high_expr.X_add_number + 0x8000)
high_expr.X_add_number += 0x10000; >> 16) & 0xffff;
high_expr.X_add_number =
((unsigned long) high_expr.X_add_number >> 16) & 0xffff;
r = BFD_RELOC_UNUSED; r = BFD_RELOC_UNUSED;
} }
else else
@ -4982,7 +4980,7 @@ macro (ip)
With a constant we always use the latter case. */ With a constant we always use the latter case. */
if (breg == 0) if (breg == 0)
{ {
if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET if ((valueT) offset_expr.X_add_number > MAX_GPREL_OFFSET
|| nopic_need_relax (offset_expr.X_add_symbol, 1)) || nopic_need_relax (offset_expr.X_add_symbol, 1))
p = NULL; p = NULL;
else else
@ -5007,7 +5005,7 @@ macro (ip)
} }
else else
{ {
if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET if ((valueT) offset_expr.X_add_number > MAX_GPREL_OFFSET
|| nopic_need_relax (offset_expr.X_add_symbol, 1)) || nopic_need_relax (offset_expr.X_add_symbol, 1))
p = NULL; p = NULL;
else else
@ -5502,7 +5500,7 @@ macro (ip)
If there is a base register, we add it to $at after the If there is a base register, we add it to $at after the
lui instruction. If there is a constant, we always use lui instruction. If there is a constant, we always use
the last case. */ the last case. */
if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET if ((valueT) offset_expr.X_add_number > MAX_GPREL_OFFSET
|| nopic_need_relax (offset_expr.X_add_symbol, 1)) || nopic_need_relax (offset_expr.X_add_symbol, 1))
{ {
p = NULL; p = NULL;
@ -7806,7 +7804,7 @@ mips_ip (str, ip)
case 'u': /* upper 16 bits */ case 'u': /* upper 16 bits */
c = my_getSmallExpression (&imm_expr, s); c = my_getSmallExpression (&imm_expr, s);
imm_reloc = BFD_RELOC_LO16; imm_reloc = BFD_RELOC_LO16;
if (c) if (c != S_EX_NONE)
{ {
if (c != S_EX_LO) if (c != S_EX_LO)
{ {
@ -8677,13 +8675,14 @@ my_getSmallExpression (ep, str)
else if (str[0] == '%' else if (str[0] == '%'
&& tolower(str[1]) == 'g' && tolower(str[1]) == 'g'
&& tolower(str[2]) == 'p' && tolower(str[2]) == 'p'
&& tolower(str[3]) == 'r' && tolower(str[3]) == '_'
&& tolower(str[4]) == 'e' && tolower(str[4]) == 'r'
&& tolower(str[5]) == 'l' && tolower(str[5]) == 'e'
&& str[6] == '(') && tolower(str[6]) == 'l'
&& str[7] == '(')
{ {
c = S_EX_GPREL; c = S_EX_GPREL;
str += sizeof ("%gprel(") - 2; str += sizeof ("%gp_rel(") - 2;
} }
else if (str[0] == '%' else if (str[0] == '%'
&& tolower(str[1]) == 'n' && tolower(str[1]) == 'n'
@ -9723,9 +9722,7 @@ md_apply_fix (fixP, valueP)
value += (fixP->fx_next->fx_frag->fr_address value += (fixP->fx_next->fx_frag->fr_address
+ fixP->fx_next->fx_where); + fixP->fx_next->fx_where);
} }
if (value & 0x8000) value = ((value + 0x8000) >> 16) & 0xffff;
value += 0x10000;
value >>= 16;
buf = (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where; buf = (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where;
if (target_big_endian) if (target_big_endian)
buf += 2; buf += 2;

View File

@ -47,7 +47,7 @@ struct expressionS;
/* Maximum symbol offset that can be encoded in a BFD_RELOC_MIPS_GPREL /* Maximum symbol offset that can be encoded in a BFD_RELOC_MIPS_GPREL
relocation: */ relocation: */
#define MAX_GPREL_OFFSET (0x7FF4) #define MAX_GPREL_OFFSET (0x7FF0)
#define md_relax_frag(segment, fragp, stretch) mips_relax_frag(fragp, stretch) #define md_relax_frag(segment, fragp, stretch) mips_relax_frag(fragp, stretch)
extern int mips_relax_frag PARAMS ((struct frag *, long)); extern int mips_relax_frag PARAMS ((struct frag *, long));