/usr/bin/clang: compilation fails on MIPS due to missing _MIPS_SZPTR macro
Aurelien Jarno
aurelien at aurel32.net
Mon Jun 6 18:36:26 UTC 2011
clone 601645 -1
reopen -1
reassign -1 clang 2.9-1
thanks
Hi,
On Wed, Oct 27, 2010 at 10:32:01PM -0400, Mark Heily wrote:
> Package: clang
> Version: 2.7-3
> Severity: normal
> File: /usr/bin/clang
>
> clang is unable to compile a trivial program on MIPS due to a glibc
> dependency on GCC-specific macros. Here is a command that
> demonstrates the failure:
>
> $ echo '#include <stdlib.h>' | clang -x c -
> clang: warning: unknown platform, assuming -mfloat-abi=soft
> In file included from <stdin>:1:
> In file included from /usr/include/stdlib.h:320:
> In file included from /usr/include/sys/types.h:31:
> /usr/include/bits/types.h:128:3: error: #error
>
> The problem is that glibc expects the macro _MIPS_SZPTR to be
> defined by the compiler. Clang does not appear to define this macro.
> Glibc uses _MIPS_SZPTR to set the value of __WORDSIZE, so you can
> workaround the compilation issue like this:
>
> printf "#define _MIPS_SZPTR 32\n#include <stdlib.h>\n" | clang -x c -
>
> The Linux kernel sources mention several other MIPS-related macros
> that are specific to GCC and may not be implemented by other
> compilers [1].
>
This bug has been workaround in eglibc 2.13-5 by using another way to
define __WORDSIZE on clang.
That said after discussing with upstream, it clearly appears to be a
clang issue. _MIPS_SZPTR has been defined by SGI and must be present
in all compilers targeting MIPS. Some more details are given in
"MIPSpro(TM) Compiling and Performance Tuning Guide" (SGI's document
#007-2360-008).
I am therefore cloning and reassigning this bug to clang. I'll keep the
workaround in eglibc until the problem is solved on the clang side.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien at aurel32.net http://www.aurel32.net
More information about the Pkg-llvm-team
mailing list