public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Code cleanup in tc-mips.c
@ 2001-08-21 12:15 Thiemo Seufer
  2001-08-21 12:50 ` Eric Christopher
  0 siblings, 1 reply; 12+ messages in thread
From: Thiemo Seufer @ 2001-08-21 12:15 UTC (permalink / raw)
  To: binutils

Hi All,

this patch does some code cleanup and fixes the still unused parsing
of %gp_rel.


Thiemo


2001-08-21  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>

	/gas/ChangeLog
	* 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.


diff -BurpNX /bigdisk/src/binutils-exclude src-orig/gas/config/tc-mips.h src/gas/config/tc-mips.h
--- src-orig/gas/config/tc-mips.h	Sat Aug 18 21:47:23 2001
+++ src/gas/config/tc-mips.h	Sat Aug 18 22:42:17 2001
@@ -47,7 +47,7 @@ struct expressionS;
 
 /* Maximum symbol offset that can be encoded in a BFD_RELOC_MIPS_GPREL
    relocation: */
-#define MAX_GPREL_OFFSET (0x7FF4)
+#define MAX_GPREL_OFFSET (0x7FF0)
 
 #define md_relax_frag(segment, fragp, stretch) mips_relax_frag(fragp, stretch)
 extern int mips_relax_frag PARAMS ((struct frag *, long));
diff -BurpNX /bigdisk/src/binutils-exclude src-orig/gas/config/tc-mips.c src/gas/config/tc-mips.c
--- src-orig/gas/config/tc-mips.c	Sat Aug 18 21:47:23 2001
+++ src/gas/config/tc-mips.c	Tue Aug 21 18:21:49 2001
@@ -2861,10 +2927,8 @@ macro_build_lui (place, counter, ep, reg
   if (high_expr.X_op == O_constant)
     {
       /* we can compute the instruction now without a relocation entry */
-      if (high_expr.X_add_number & 0x8000)
-	high_expr.X_add_number += 0x10000;
-      high_expr.X_add_number =
-	((unsigned long) high_expr.X_add_number >> 16) & 0xffff;
+      high_expr.X_add_number = ((high_expr.X_add_number + 0x8000)
+				>> 16) & 0xffff;
       r = BFD_RELOC_UNUSED;
     }
   else
@@ -4963,6 +5148,6 @@ macro (ip)
 	  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))
 		p = NULL;
 	      else
@@ -4991,7 +5257,7 @@ macro (ip)
 	    }
 	  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))
 		p = NULL;
 	      else
@@ -5486,7 +5752,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 ((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))
 	    {
 	      p = NULL;
@@ -7790,7 +8060,7 @@ mips_ip (str, ip)
 	    case 'u':		/* upper 16 bits */
 	      c = my_getSmallExpression (&imm_expr, s);
 	      imm_reloc = BFD_RELOC_LO16;
-	      if (c)
+	      if (c != S_EX_NONE)
 		{
 		  if (c != S_EX_LO)
 		    {
@@ -8661,13 +8931,14 @@ my_getSmallExpression (ep, str)
   else if (str[0] == '%'
 	   && tolower(str[1]) == 'g'
 	   && tolower(str[2]) == 'p'
-	   && tolower(str[3]) == 'r'
-	   && tolower(str[4]) == 'e'
-	   && tolower(str[5]) == 'l'
-	   && str[6] == '(')
+	   && tolower(str[3]) == '_'
+	   && tolower(str[4]) == 'r'
+	   && tolower(str[5]) == 'e'
+	   && tolower(str[6]) == 'l'
+	   && str[7] == '(')
     {
       c = S_EX_GPREL;
-      str += sizeof ("%gprel(") - 2;
+      str += sizeof ("%gp_rel(") - 2;
     }
   else if (str[0] == '%'
 	   && tolower(str[1]) == 'n'
@@ -9703,9 +9995,7 @@ md_apply_fix (fixP, valueP)
 	  value += (fixP->fx_next->fx_frag->fr_address
 		    + fixP->fx_next->fx_where);
 	}
-      if (value & 0x8000)
-	value += 0x10000;
-      value >>= 16;
+      value = ((value + 0x8000) >> 16) & 0xffff;
       buf = (unsigned char *) fixP->fx_frag->fr_literal + fixP->fx_where;
       if (target_big_endian)
 	buf += 2;

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
  2001-08-21 12:15 [PATCH] Code cleanup in tc-mips.c Thiemo Seufer
@ 2001-08-21 12:50 ` Eric Christopher
  2001-08-21 13:14   ` Thiemo Seufer
  0 siblings, 1 reply; 12+ messages in thread
From: Eric Christopher @ 2001-08-21 12:50 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

On 21 Aug 2001 21:15:00 +0200, Thiemo Seufer wrote:
> Hi All,
> 
> this patch does some code cleanup and fixes the still unused parsing
> of %gp_rel.
> 
>

Tested on/via ... with no regressions?

> 2001-08-21  Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
> 
> 	/gas/ChangeLog
> 	* 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.
> 
> 
-- 
Look out behind you!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
  2001-08-21 12:50 ` Eric Christopher
@ 2001-08-21 13:14   ` Thiemo Seufer
  2001-08-21 15:12     ` Eric Christopher
  0 siblings, 1 reply; 12+ messages in thread
From: Thiemo Seufer @ 2001-08-21 13:14 UTC (permalink / raw)
  To: binutils

Eric Christopher wrote:
> On 21 Aug 2001 21:15:00 +0200, Thiemo Seufer wrote:
> > Hi All,
> > 
> > this patch does some code cleanup and fixes the still unused parsing
> > of %gp_rel.
> > 
> >
> 
> Tested on/via ... with no regressions?

The %gp_rel is part of the %higher/%highest support which has no
test ATM, you may remember...

The patch was tested for mips64-linux without regressions.


Thiemo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
  2001-08-21 13:14   ` Thiemo Seufer
@ 2001-08-21 15:12     ` Eric Christopher
  2001-08-21 15:27       ` Thiemo Seufer
  0 siblings, 1 reply; 12+ messages in thread
From: Eric Christopher @ 2001-08-21 15:12 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

> The %gp_rel is part of the %higher/%highest support which has no
> test ATM, you may remember...
> 
> The patch was tested for mips64-linux without regressions.
> 

Thanks.  I figure if I keep reminding you I might get you to mention it
with the patch you send :)

Try to test with the compiler if possible too.

-eric

-- 
Look out behind you!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
  2001-08-21 15:12     ` Eric Christopher
@ 2001-08-21 15:27       ` Thiemo Seufer
  2001-08-21 15:30         ` Eric Christopher
  2001-08-21 15:36         ` H . J . Lu
  0 siblings, 2 replies; 12+ messages in thread
From: Thiemo Seufer @ 2001-08-21 15:27 UTC (permalink / raw)
  To: binutils

Eric Christopher wrote:
> 
> > The %gp_rel is part of the %higher/%highest support which has no
> > test ATM, you may remember...
> > 
> > The patch was tested for mips64-linux without regressions.
> > 
> 
> Thanks.  I figure if I keep reminding you I might get you to mention it
> with the patch you send :)

Well, the patches I post are usually at least several days old, and
"make check" is part of my normal build process. I think I'll
mention this more often in future. :-)

> Try to test with the compiler if possible too.

I currently try to get CVS gcc working on mips64-linux.


Thiemo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
  2001-08-21 15:27       ` Thiemo Seufer
@ 2001-08-21 15:30         ` Eric Christopher
  2001-08-24 10:46           ` Thiemo Seufer
  2001-08-21 15:36         ` H . J . Lu
  1 sibling, 1 reply; 12+ messages in thread
From: Eric Christopher @ 2001-08-21 15:30 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

> 
> Well, the patches I post are usually at least several days old, and
> "make check" is part of my normal build process. I think I'll
> mention this more often in future. :-)
> 

Yup.  Just mention it. :)

> > Try to test with the compiler if possible too.
> 
> I currently try to get CVS gcc working on mips64-linux.
> 

Cool.  If you could try to keep a typical mips-elf compiler around I'd
appreciate it.

-eric



-- 
Look out behind you!

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
  2001-08-21 15:27       ` Thiemo Seufer
  2001-08-21 15:30         ` Eric Christopher
@ 2001-08-21 15:36         ` H . J . Lu
       [not found]           ` <20010822012500.O30301@rembrandt.csv.ica.uni-stuttgart.de>
  1 sibling, 1 reply; 12+ messages in thread
From: H . J . Lu @ 2001-08-21 15:36 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

On Wed, Aug 22, 2001 at 12:27:43AM +0200, Thiemo Seufer wrote:
> 
> > Try to test with the compiler if possible too.
> 
> I currently try to get CVS gcc working on mips64-linux.
> 

What ABI do you use for mips64-linux? I think it may be a good idea
to use the SGI 64bit ABI. It is documented. I think it may have better
support in gcc than other 64bit misp ABI.


H.J.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
       [not found]           ` <20010822012500.O30301@rembrandt.csv.ica.uni-stuttgart.de>
@ 2001-08-21 16:58             ` H . J . Lu
  2001-08-21 17:39               ` Thiemo Seufer
  0 siblings, 1 reply; 12+ messages in thread
From: H . J . Lu @ 2001-08-21 16:58 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

On Wed, Aug 22, 2001 at 01:25:00AM +0200, Thiemo Seufer wrote:
> H . J . Lu wrote:
> > On Wed, Aug 22, 2001 at 12:27:43AM +0200, Thiemo Seufer wrote:
> > > 
> > > > Try to test with the compiler if possible too.
> > > 
> > > I currently try to get CVS gcc working on mips64-linux.
> > > 
> > 
> > What ABI do you use for mips64-linux? I think it may be a good idea
> > to use the SGI 64bit ABI.
> 
> I dislike the symbol sorting, and little endian support might be a

Me either.

> good thing also, so I used elf64-tradbigmips, not elf64-bigmips.

The little endian support is not a major issue.

> 
> > It is documented. I think it may have better
> > support in gcc than other 64bit misp ABI.
> 
> Old ECOFF isn't even an issue. Did you mean something else?

The SGI 64bit ABI corrected a few mistakes in the 32bit SVR4 MIPS ABI. 
But it also has other stuff we may not need. I have a wish list for
a 64bit MIPS ABI.

> 
> 

BTW, all my emails sent to you are blocked. I have to send it to
the binutils mailing list.


H.J.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
  2001-08-21 16:58             ` H . J . Lu
@ 2001-08-21 17:39               ` Thiemo Seufer
  2001-08-22  8:36                 ` H . J . Lu
  0 siblings, 1 reply; 12+ messages in thread
From: Thiemo Seufer @ 2001-08-21 17:39 UTC (permalink / raw)
  To: binutils

H . J . Lu wrote:
[snip]
> > > It is documented. I think it may have better
> > > support in gcc than other 64bit misp ABI.
> > 
> > Old ECOFF isn't even an issue. Did you mean something else?
> 
> The SGI 64bit ABI corrected a few mistakes in the 32bit SVR4 MIPS ABI. 
> But it also has other stuff we may not need. I have a wish list for
> a 64bit MIPS ABI.

What do you think is superfluous? QuickStart?

[snip]
> BTW, all my emails sent to you are blocked. I have to send it to
> the binutils mailing list.

Our DNS can't resolve the MX for lucon.org. Local problem here,
I assume. :-(


Thiemo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
  2001-08-21 17:39               ` Thiemo Seufer
@ 2001-08-22  8:36                 ` H . J . Lu
  0 siblings, 0 replies; 12+ messages in thread
From: H . J . Lu @ 2001-08-22  8:36 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

On Wed, Aug 22, 2001 at 02:39:27AM +0200, Thiemo Seufer wrote:
> H . J . Lu wrote:
> [snip]
> > > > It is documented. I think it may have better
> > > > support in gcc than other 64bit misp ABI.
> > > 
> > > Old ECOFF isn't even an issue. Did you mean something else?
> > 
> > The SGI 64bit ABI corrected a few mistakes in the 32bit SVR4 MIPS ABI. 
> > But it also has other stuff we may not need. I have a wish list for
> > a 64bit MIPS ABI.
> 
> What do you think is superfluous? QuickStart?

Yes. We don't need it and anything related to it. Jakub is working on
prelink for glibc. But the MIPS ABI doesn't help.

> 
> [snip]
> > BTW, all my emails sent to you are blocked. I have to send it to
> > the binutils mailing list.
> 
> Our DNS can't resolve the MX for lucon.org. Local problem here,
> I assume. :-(

Let me give it a try this time.


H.J.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
  2001-08-21 15:30         ` Eric Christopher
@ 2001-08-24 10:46           ` Thiemo Seufer
  2001-08-24 11:49             ` Eric Christopher
  0 siblings, 1 reply; 12+ messages in thread
From: Thiemo Seufer @ 2001-08-24 10:46 UTC (permalink / raw)
  To: binutils

Eric Christopher wrote:
> 
> > 
> > Well, the patches I post are usually at least several days old, and
> > "make check" is part of my normal build process. I think I'll
> > mention this more often in future. :-)
> > 
> 
> Yup.  Just mention it. :)

Tested the patch additionally for mips-elf and mips64el-elf without
regressions.

> > > Try to test with the compiler if possible too.
> > 
> > I currently try to get CVS gcc working on mips64-linux.
> > 
> 
> Cool.  If you could try to keep a typical mips-elf compiler around I'd
> appreciate it.

FYI: Compilation of CVS gcc fails for both mips-elf and mips64el-elf
with this message:
|crtstuff.c:558:2: #error "What are you doing with crtstuff.c, then?"


Thiemo

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Code cleanup in tc-mips.c
  2001-08-24 10:46           ` Thiemo Seufer
@ 2001-08-24 11:49             ` Eric Christopher
  0 siblings, 0 replies; 12+ messages in thread
From: Eric Christopher @ 2001-08-24 11:49 UTC (permalink / raw)
  To: Thiemo Seufer; +Cc: binutils

> FYI: Compilation of CVS gcc fails for both mips-elf and mips64el-elf
> with this message:
> |crtstuff.c:558:2: #error "What are you doing with crtstuff.c, then?"
> 

I'll have a fix in for mips-elf today.  I'm having abi issues with
mips64. I'll send you my (untested) patches if you'd like.

-eric

-- 
Look out behind you!

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2001-08-24 11:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-21 12:15 [PATCH] Code cleanup in tc-mips.c Thiemo Seufer
2001-08-21 12:50 ` Eric Christopher
2001-08-21 13:14   ` Thiemo Seufer
2001-08-21 15:12     ` Eric Christopher
2001-08-21 15:27       ` Thiemo Seufer
2001-08-21 15:30         ` Eric Christopher
2001-08-24 10:46           ` Thiemo Seufer
2001-08-24 11:49             ` Eric Christopher
2001-08-21 15:36         ` H . J . Lu
     [not found]           ` <20010822012500.O30301@rembrandt.csv.ica.uni-stuttgart.de>
2001-08-21 16:58             ` H . J . Lu
2001-08-21 17:39               ` Thiemo Seufer
2001-08-22  8:36                 ` H . J . Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).