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


On Sat, 6 Nov 2004, Alexandre Oliva wrote:

> >  As of GCC 3.4 the preprocessor does not use any of _MIPS_SIM_* macros 
> > anymore.  Glibc still depends on them and depending on your setup building 
> > may succeed or not
> 
> Err...  I went through this some time ago, and I think the patch to
> fix these issues is already in.  Is your patch against mainline?

 As you could have inferred from the name of the patch it's against a
snapshot from Oct 18th.  It applies cleanly against the CVS as of today.

> > 1. Glibc can only be built with GCC 3.2 or higher.  That version already 
> > knew of _ABIN32 and _ABI64, but not about _ABIO32 (probably due to an 
> > omission).
> 
> _ABIO32 was not defined back then.  And, in fact, we shouldn't rely on
> the compiler defining any of these macros, since they are GCC-internal
> and subject to change.  We'd better rely on the macros defined by the
> MIPS ABI specs, that are only available after inclusion of sgidefs.h.
> I've changed all of the files in CVS some time ago to use _MIPS_SIM_*

 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.  My changes fix that by providing this relationship.

> macros.  With this change, glibc would build not only with GCC 3.4ish,
> but also with earlier versions.  We should probably stick with this
> approach, instead of risking being bitten again by relying on
> compiler-internal undocumented macros.

 It wouldn't build with GCC 3.4.2.  It might probably build with older
versions.  After my changes, code should build with all reasonable
versions in existence (starting with GCC 3.2 for glibc itself and whatever
was first to define _MIPS_SIM for MIPS/Linux for user code; certainly
2.95.x, probably older) and starting with GCC 3.4 even without including
<sgidefs.h>.  It works for me with GCC 3.4.2.

 Then none of these macros are actually documented.  But _MIPS_SIM and the
_ABI* ones are at least defined by GCC itself, so they reliably tell you
about the ABI used by GCC.  It used not to be the case with the
_MIPS_SIM_* macros referred to by older compilers, but actually not
defined by them.  I suppose that's the reason they got rid off from newer
GCC versions.

 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.  
Eric?  Richard?

  Maciej


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