* MIPS glibc-2.3.2 build failure with gcc-3.4 @ 2004-01-22 2:41 Michael Eager 2004-01-22 6:42 ` Eric Christopher 2004-01-22 11:29 ` Richard Sandiford 0 siblings, 2 replies; 5+ messages in thread From: Michael Eager @ 2004-01-22 2:41 UTC (permalink / raw) To: gcc; +Cc: amodra [-- Attachment #1: Type: text/plain, Size: 610 bytes --] I'm building glibc-2.3.2 for mips with the gcc-3.4-20040114 snapshot. I'm getting an error building sigaction.c: ../sysdeps/unix/sysv/linux/mips/sigaction.c:83: error: $1 cannot be used in asm here This code compiles using gcc-3.3.1. The error is in global_alloc (global.c:355), in code which was added to fix PR 13169 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13169) I've attached a cutdown version of sigaction.c. Command line is "mips-gcc -O2 -c sigaction.c". Suggestions? -- Michael Eager eager@mvista.com 408-328-8426 MontaVista Software, Inc. 1237 E. Arques Ave., Sunnyvale, CA 94085 [-- Attachment #2: sigaction.c --] [-- Type: text/plain, Size: 1138 bytes --] extern int *__errno_location (void) __attribute__ ((__const__)); int __libc_sigaction (sig, act, oact) int sig; int *act; int *oact; { int result; { int kact, koact; if (act) result = ( { long err; long result_var = ( { long _sys_result; { register long __v0 asm("$2"); register long __a0 asm("$4") = (long) sig; register long __a1 asm("$5") = (long) act ? (&kact) : ((void *)0); register long __a2 asm("$6") = (long) oact ? (&koact) : ((void *)0); register long __a3 asm("$7") = (long) sizeof (int); __asm__ volatile ( ".set\tnoreorder\n\t" "li\t$2, %5\t\t\t# " "rt_sigaction" "\n\t" "syscall\n\t" ".set\treorder" : "=r" (__v0), "+r" (__a3) : "r" (__a0), "r" (__a1), "r" (__a2), "i" ((4000 + 194)) : "$1", "$3", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25"); err = __a3; _sys_result = __v0; } _sys_result; }); if ( ((long) (err)) ) { ((*__errno_location ()) = ((result_var))); result_var = -1L; } result_var; }); { return result; } } } ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MIPS glibc-2.3.2 build failure with gcc-3.4 2004-01-22 2:41 MIPS glibc-2.3.2 build failure with gcc-3.4 Michael Eager @ 2004-01-22 6:42 ` Eric Christopher 2004-01-22 11:29 ` Richard Sandiford 1 sibling, 0 replies; 5+ messages in thread From: Eric Christopher @ 2004-01-22 6:42 UTC (permalink / raw) To: Michael Eager; +Cc: gcc, amodra On Wed, 2004-01-21 at 18:08, Michael Eager wrote: > I'm building glibc-2.3.2 for mips with the gcc-3.4-20040114 snapshot. > > I'm getting an error building sigaction.c: > ../sysdeps/unix/sysv/linux/mips/sigaction.c:83: error: $1 cannot be used in asm here > > This code compiles using gcc-3.3.1. > > The error is in global_alloc (global.c:355), in code which was added to > fix PR 13169 (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13169) > > I've attached a cutdown version of sigaction.c. > > Command line is "mips-gcc -O2 -c sigaction.c". > > Suggestions? .set at or don't use $1 there and actually use the instructions you want. -eric -- Eric Christopher <echristo@redhat.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MIPS glibc-2.3.2 build failure with gcc-3.4 2004-01-22 2:41 MIPS glibc-2.3.2 build failure with gcc-3.4 Michael Eager 2004-01-22 6:42 ` Eric Christopher @ 2004-01-22 11:29 ` Richard Sandiford 2004-01-22 11:31 ` Richard Sandiford 2004-01-22 20:09 ` Michael Eager 1 sibling, 2 replies; 5+ messages in thread From: Richard Sandiford @ 2004-01-22 11:29 UTC (permalink / raw) To: Michael Eager; +Cc: gcc, amodra Michael Eager <eager@mvista.com> writes: > I'm building glibc-2.3.2 for mips with the gcc-3.4-20040114 snapshot. > > I'm getting an error building sigaction.c: > ../sysdeps/unix/sysv/linux/mips/sigaction.c:83: error: $1 cannot be used in asm here > > This code compiles using gcc-3.3.1. This is a side-effect of a "cute" trick in the MIPS port. Since it doesn't use $1 for anything, it reuses register 1 for FRAME_POINTER_REGNUM. I guess this was a good idea at one time (it reduced the number of hard registers so could have reduced memory requirements or compile time). But these days we have several hard registers that aren't being used for anything. We might as well use one of them as the frame pointer. I've just tried the quick hack below and it seems to make your test case pass. I'll try to clean it up and test it later. In the meantime, can you file a bug report for this so that we don't lose track of it? Thanks. Richard Index: config/mips/mips.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v retrieving revision 1.366 diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.366 mips.c --- config/mips/mips.c 20 Jan 2004 19:58:59 -0000 1.366 +++ config/mips/mips.c 22 Jan 2004 11:19:15 -0000 @@ -572,7 +572,7 @@ char mips_reg_names[][8] = "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23", "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31", "hi", "lo", "", "$fcc0","$fcc1","$fcc2","$fcc3","$fcc4", - "$fcc5","$fcc6","$fcc7","", "", "", "", "$fakec", + "$fcc5","$fcc6","$fcc7","", "", "", "$frame", "$fakec", "$c0r0", "$c0r1", "$c0r2", "$c0r3", "$c0r4", "$c0r5", "$c0r6", "$c0r7", "$c0r8", "$c0r9", "$c0r10","$c0r11","$c0r12","$c0r13","$c0r14","$c0r15", "$c0r16","$c0r17","$c0r18","$c0r19","$c0r20","$c0r21","$c0r22","$c0r23", @@ -601,7 +601,7 @@ char mips_sw_reg_names[][8] = "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23", "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31", "hi", "lo", "", "$fcc0","$fcc1","$fcc2","$fcc3","$fcc4", - "$fcc5","$fcc6","$fcc7","$rap", "", "", "", "$fakec", + "$fcc5","$fcc6","$fcc7","$rap", "", "", "$frame", "$fakec", "$c0r0", "$c0r1", "$c0r2", "$c0r3", "$c0r4", "$c0r5", "$c0r6", "$c0r7", "$c0r8", "$c0r9", "$c0r10","$c0r11","$c0r12","$c0r13","$c0r14","$c0r15", "$c0r16","$c0r17","$c0r18","$c0r19","$c0r20","$c0r21","$c0r22","$c0r23", @@ -638,7 +638,7 @@ const enum reg_class mips_regno_to_class HI_REG, LO_REG, NO_REGS, ST_REGS, ST_REGS, ST_REGS, ST_REGS, ST_REGS, ST_REGS, ST_REGS, ST_REGS, NO_REGS, - NO_REGS, NO_REGS, NO_REGS, NO_REGS, + NO_REGS, NO_REGS, ALL_REGS, NO_REGS, COP0_REGS, COP0_REGS, COP0_REGS, COP0_REGS, COP0_REGS, COP0_REGS, COP0_REGS, COP0_REGS, COP0_REGS, COP0_REGS, COP0_REGS, COP0_REGS, Index: config/mips/mips.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.h,v retrieving revision 1.310 diff -u -p -F^\([(a-zA-Z0-9_]\|#define\) -r1.310 mips.h --- config/mips/mips.h 7 Jan 2004 00:52:31 -0000 1.310 +++ config/mips/mips.h 22 Jan 2004 11:19:16 -0000 @@ -1665,7 +1665,7 @@ #define STACK_POINTER_REGNUM (GP_REG_FIR pretend that the frame pointer is $1, and then eliminate it to HARD_FRAME_POINTER_REGNUM. We can get away with this because $1 is a fixed register, and will not be used for anything else. */ -#define FRAME_POINTER_REGNUM (GP_REG_FIRST + 1) +#define FRAME_POINTER_REGNUM 78 /* $30 is not available on the mips16, so we use $17 as the frame pointer. */ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MIPS glibc-2.3.2 build failure with gcc-3.4 2004-01-22 11:29 ` Richard Sandiford @ 2004-01-22 11:31 ` Richard Sandiford 2004-01-22 20:09 ` Michael Eager 1 sibling, 0 replies; 5+ messages in thread From: Richard Sandiford @ 2004-01-22 11:31 UTC (permalink / raw) To: Michael Eager; +Cc: gcc, amodra Richard Sandiford <rsandifo@redhat.com> writes: > Since it doesn't use $1 for anything, ...in rtl, I mean. Obviously some patterns will use $1 as a temporary register internally. Richard ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MIPS glibc-2.3.2 build failure with gcc-3.4 2004-01-22 11:29 ` Richard Sandiford 2004-01-22 11:31 ` Richard Sandiford @ 2004-01-22 20:09 ` Michael Eager 1 sibling, 0 replies; 5+ messages in thread From: Michael Eager @ 2004-01-22 20:09 UTC (permalink / raw) To: Richard Sandiford; +Cc: Michael Eager, gcc Richard Sandiford wrote: > Michael Eager <eager@mvista.com> writes: > >>I'm building glibc-2.3.2 for mips with the gcc-3.4-20040114 snapshot. >> >>I'm getting an error building sigaction.c: >> ../sysdeps/unix/sysv/linux/mips/sigaction.c:83: error: $1 cannot be used in asm here >> >>This code compiles using gcc-3.3.1. > > > This is a side-effect of a "cute" trick in the MIPS port. > Since it doesn't use $1 for anything, it reuses register 1 for > FRAME_POINTER_REGNUM. > > I guess this was a good idea at one time (it reduced the number of hard > registers so could have reduced memory requirements or compile time). > But these days we have several hard registers that aren't being used for > anything. We might as well use one of them as the frame pointer. > > I've just tried the quick hack below and it seems to make > your test case pass. I'll try to clean it up and test it later. Yes, your patch fixes the problem. > In the meantime, can you file a bug report for this so that > we don't lose track of it? Thanks. Will do. -- Michael Eager Eager Consulting eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-01-22 20:07 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2004-01-22 2:41 MIPS glibc-2.3.2 build failure with gcc-3.4 Michael Eager 2004-01-22 6:42 ` Eric Christopher 2004-01-22 11:29 ` Richard Sandiford 2004-01-22 11:31 ` Richard Sandiford 2004-01-22 20:09 ` Michael Eager
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).