This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] MIPS/Linux: Clean up cpp ABI dependencies


"Maciej W. Rozycki" <macro@linux-mips.org> writes:
>  Well, they still rely on GCC predefining macros.  It's worse even --
> current versions of GCC predefine _MIPS_SIM to one of _ABIO32, _ABIN32 or
> _ABI64.  But your tests check _MIPS_SIM against _MIPS_SIM_ABI32,
> _MIPS_SIM_NABI32 or _MIPS_SIM_ABI64.  Currently there is no relationship
> between these two sets (_ABI* vs _MIPS_SIM_*) and tests work by
> coincidence -- they rely on _ABIO32 being equal to _MIPS_SIM_ABI32,
> _ABIN32 being equal to _MIPS_SIM_NABI32 and _ABI64 being equal to
> _MIPS_SIM_ABI64.

This is no coincidence.  It's very much a requirement that _ABIO32 ==
_MIPS_SIM_ABI32, etc.

The issue here is that it's up to <sgidefs.h>, not the compiler,
to define the _MIPS_SIM_* macros, and you therefore have to include
<sgidefs.h> to access them.  But the compiler-defined _MIPS_SIM is
designed to be comparable with macros like _MIPS_SIM_ABI32: that's
the whole point.

To quote from SGI's implementation of <sgidefs.h>:

 *      If you use the _MIPS_* defines, you should include this header file.
 *      In order to avoid problems when sgidefs.h is not included, the driver
 *      predefines _MIPS_ISA and _MIPS_SIM to be the actual values (1-4) 
 *      rather than the _MIPS_* names (otherwise, if sgidefs.h is not 
 *      included, we would be defining _MIPS_SIM to be an undefined value).

Not an ideal arrangement perhaps, since comparisons against an undefined
_MIPS_SIM_* macro won't generate an error.  But that's how the interface
is defined (by SGI, I mean, not gcc maintainers ;).

GCC also defines _ABIO32 & co. as a convenience for those who don't
want to depend on a header file and who don't care about non-gcc
(or past-gcc) compatibility.  But...

>  We may ask GCC maintainers what's the planned policy wrt these macros and
> if they deserve being documented and kept unchanged for the future.  

...the values of _MIPS_SIM and _MIPS_SIM_* are stable.  From a gcc
point of view, there's no reason to prefer _ABI* over _MIPS_SIM_*,
or vice versa.

The _MIPS_SIM_* macros are definitely more backwards-compatible though.
FWIW, I think gcc should continue using them.

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]