3.4 PATCH: Consistently use _ABIO32 for _MIPS_SIM

Rainer Orth ro@TechFak.Uni-Bielefeld.DE
Thu Oct 9 18:26:00 GMT 2003


Alexandre Oliva writes:

> Err...  What I see is _MIPS_SIM_ABI32.  I can't see any reference to
> _ABIO32 in the MIPSpro N32 porting guide, FWIW.

They are documented in IRIX 6.5 abi(5):

http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=0650&db=man&fname=/usr/share/catman/p_man/cat5/abi.z

I think we're dealing with two different problems here:

* config/mips/{iris6.h, linux.h} used to define _MIPS_SIM for the O32 ABI
  in terms of another macro not defined by gcc itself (or SGI's MIPSpro C,
  for that matter), namely _MIPS_SIM_ABI32.  If that macro happened to be
  defined by some other header (by including <sgidefs.h>, either directly
  or indirectly), all was fine.  If not, this breaks since the macro is
  defined as 1, whereas an undefined macro evaluates to 0.  For the N32 and
  N64 ABIs, _MIPS_SIM was defined using _ABIN32 and _ABI64 respectively,
  which gcc (again like MIPSpro C) predefines itself.

  Since the _ABI* values are guaranteed to be predefined by GCC, I suggest
  to use them *throughout GCC sources* to test for the different values of
  _MIPS_SIM.  I recall that in the past we had several problems when
  <sgidefs.h> wasn't included and the _MIPS_SIM_*ABI* symbols weren't
  available.

* In *user code*, it is probably best to use the _MIPS_SIM_*ABI* symbols
  *after making sure they are defined by including the appropriate
  headers*.  As you indicate, they are used exclusively throughout the
  various MIPSpro porting and ABI guides, while the IRIX 6 headers use a
  mixture of _MIPS_SIM_*ABI* and _ABI*.

  E.g., the IRIX 5.3 cc(1) man page explicitly indicates

						The _MIPS_ISA_MIPS1,
     _MIPS_ISA_MIPS2, and _MIPS_SIM_ABI32 symbols are defined in <sgidefs.h>
     and should never be referenced unless this file has first been included.

  And IRIX 6.5 <sgidefs.h> indicates:

/*
 * Compilation Environments
 *	The compiler can offer a set of different compilation environments.
 *	Each one will pre-define the above defines appropriately.
 * 	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).
 * 
 * The following #if conditions will be true in each environment:
 * 	The MIPS ABI (-o32) environment:
 * 	_MIPS_ISA == _MIPS_ISA_MIPS1 or _MIPS_ISA_MIPS2
 *	_MIPS_SIM == _MIPS_SIM_ABI32

I therefore suggest that we continue to not predefine _MIPS_ISA_ABI* by gcc
to avoid problems for users that use both cc and gcc: code that works for
gcc without <sgidefs.h> suddenly breaks with cc when <sgidefs.h> is not
included.

If you all agree on this approach, I'll start with regtesting the patch: a
full bootstrap and regtest with all three ABIs takes some time, so I'd like
to avoid starting all over when there is significant disagreement here.

	Rainer



More information about the Libstdc++ mailing list