public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][MIPS] clang support
@ 2011-06-04 16:40 Aurelien Jarno
  2011-06-06 13:03 ` Joseph S. Myers
  0 siblings, 1 reply; 4+ messages in thread
From: Aurelien Jarno @ 2011-06-04 16:40 UTC (permalink / raw)
  To: libc-ports

When trying to build clang programs on MIPS, they fail as clang doesn't
export the _MIPS_SZPTR builtin. The patch below fixes that by using
_MIPS_SZPTR when available with a fallback on __INTPTR_WIDTH__.

2011-06-04  Aurelien Jarno  <aurelien@aurel32.net>

	* sysdeps/mips/bits/wordsize.h(__WORDSIZE): Define from _MIPS_SZPTR
	or __INTPTR_WIDTH__.

diff --git a/sysdeps/mips/bits/wordsize.h b/sysdeps/mips/bits/wordsize.h
index 06967e5..099dfdc 100644
--- a/sysdeps/mips/bits/wordsize.h
+++ b/sysdeps/mips/bits/wordsize.h
@@ -16,7 +16,13 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#define __WORDSIZE	_MIPS_SZPTR
+#if defined (_MIPS_SZPTR)
+# define __WORDSIZE	_MIPS_SZPTR
+#elif defined (__INTPTR_WIDTH__)
+# define __WORDSIZE	__INTPTR_WIDTH__
+#else
+# error Cannot define __WORDSIZE
+#endif
 #if _MIPS_SIM == _ABI64
 # define __WORDSIZE_COMPAT32	1
 #endif

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][MIPS] clang support
  2011-06-04 16:40 [PATCH][MIPS] clang support Aurelien Jarno
@ 2011-06-06 13:03 ` Joseph S. Myers
  2011-06-06 13:56   ` Maciej W. Rozycki
  0 siblings, 1 reply; 4+ messages in thread
From: Joseph S. Myers @ 2011-06-06 13:03 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: libc-ports, macro

On Sat, 4 Jun 2011, Aurelien Jarno wrote:

> When trying to build clang programs on MIPS, they fail as clang doesn't
> export the _MIPS_SZPTR builtin. The patch below fixes that by using
> _MIPS_SZPTR when available with a fallback on __INTPTR_WIDTH__.

Maciej, any comments on where the API for predefined macros on MIPS 
(_MIPS_SIM, _MIPS_SZPTR, etc.) comes from and whether it is documented?  
I'm inclined to think it's a bug in any MIPS compiler (or at least any 
compiler for MIPS Linux) to fail to define these macros.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][MIPS] clang support
  2011-06-06 13:03 ` Joseph S. Myers
@ 2011-06-06 13:56   ` Maciej W. Rozycki
  2011-06-06 19:00     ` Aurelien Jarno
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej W. Rozycki @ 2011-06-06 13:56 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Aurelien Jarno, libc-ports

On Mon, 6 Jun 2011, Joseph S. Myers wrote:

> > When trying to build clang programs on MIPS, they fail as clang doesn't
> > export the _MIPS_SZPTR builtin. The patch below fixes that by using
> > _MIPS_SZPTR when available with a fallback on __INTPTR_WIDTH__.
> 
> Maciej, any comments on where the API for predefined macros on MIPS 
> (_MIPS_SIM, _MIPS_SZPTR, etc.) comes from and whether it is documented?  

 This was originally defined by SGI.  One documentary reference I have is: 
"MIPSpro(TM) Compiling and Performance Tuning Guide" SGI's document 
#007-2360-008.

> I'm inclined to think it's a bug in any MIPS compiler (or at least any 
> compiler for MIPS Linux) to fail to define these macros.

 I agree.  Any Linux userland C code specifically crafted for a MIPS 
processor will assume these macros are available.  Note that some of them 
are defined by <sgidefs.h> rather than the compiler itself (the API is 
somewhat odd).

  Maciej

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][MIPS] clang support
  2011-06-06 13:56   ` Maciej W. Rozycki
@ 2011-06-06 19:00     ` Aurelien Jarno
  0 siblings, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2011-06-06 19:00 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Joseph S. Myers, libc-ports

On Mon, Jun 06, 2011 at 02:55:36PM +0100, Maciej W. Rozycki wrote:
> On Mon, 6 Jun 2011, Joseph S. Myers wrote:
> 
> > > When trying to build clang programs on MIPS, they fail as clang doesn't
> > > export the _MIPS_SZPTR builtin. The patch below fixes that by using
> > > _MIPS_SZPTR when available with a fallback on __INTPTR_WIDTH__.
> > 
> > Maciej, any comments on where the API for predefined macros on MIPS 
> > (_MIPS_SIM, _MIPS_SZPTR, etc.) comes from and whether it is documented?  
> 
>  This was originally defined by SGI.  One documentary reference I have is: 
> "MIPSpro(TM) Compiling and Performance Tuning Guide" SGI's document 
> #007-2360-008.
> 
> > I'm inclined to think it's a bug in any MIPS compiler (or at least any 
> > compiler for MIPS Linux) to fail to define these macros.
> 
>  I agree.  Any Linux userland C code specifically crafted for a MIPS 
> processor will assume these macros are available.  Note that some of them 
> are defined by <sgidefs.h> rather than the compiler itself (the API is 
> somewhat odd).
> 

Thanks for the details. It is now clear to me that it has to be fixed,
the clang side.

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-06 19:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-04 16:40 [PATCH][MIPS] clang support Aurelien Jarno
2011-06-06 13:03 ` Joseph S. Myers
2011-06-06 13:56   ` Maciej W. Rozycki
2011-06-06 19:00     ` Aurelien Jarno

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).