Bug 16830 - Including <sys/immu.h> with -mabi=n32 causes an error.
Summary: Including <sys/immu.h> with -mabi=n32 causes an error.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Richard Sandiford
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-30 10:37 UTC by Magnus Bergman
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target: mips-sgi-irix6.5
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Bergman 2004-07-30 10:37:03 UTC
When including <sys/immu.h> (which mozilla likes to do) the compilation halts
with the masseage: parse error before pte_t. <sys/immu.h> contains some very
low-level stuff which is ignored if the exact architecture is unknown (this is
what happens then using the native compiler). The problem is that gcc defines
"R4000" when using -mabi=n32 (not then using -mabi=32), which disables the
excusion of all the low-level stuff, but doesn't include all of it either.
The solution I can think of is either to NOT define "R4000" (which again is what
the native compiler does). Or to also define "IP20", "IP22", "IP28" or
"IPMHSIM", which would make <sys/immu.h> go through the compiler but I have no
idea if it's the correct thing to do.
Comment 1 Richard Sandiford 2004-10-26 18:52:23 UTC
Confirmed.  Of the two choices you mention, I think it would be
better to remove the R3000 and R4000 macros for IRIX.  Another
option would be to use fixincludes, but I think removing the
macros is better.  Like you say, MIPSpro doesn't define them,
even in underscore form, and they've always been a bit flawed
anyway.

[ Reasoning: the macros sound like they're indicators of the
  target ISA, but they really indicators of "64-bitness".
   __mips is a better choice if you want to know the specific
  ISA level and __mips64 is better if you just want to know
  whether the code is 64-bit or not. ]

I'll try to bootstrap the obvious patch soon, but the irix box
I use is a bit under the weather right now.
Comment 2 GCC Commits 2004-11-06 22:34:04 UTC
Subject: Bug 16830

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rsandifo@gcc.gnu.org	2004-11-06 22:34:01

Modified files:
	gcc            : ChangeLog 
	gcc/config/mips: mips.h 

Log message:
	PR target/16830
	* config/mips/mips.h (TARGET_CPU_CPP_BUILTINS): Don't define the
	R3000 and R4000 macros on IRIX.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6210&r2=2.6211
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/mips/mips.h.diff?cvsroot=gcc&r1=1.374&r2=1.375

Comment 3 Richard Sandiford 2004-11-06 22:39:31 UTC
Fixed in mainline:

   http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00513.html