LLVM-3.0 fails to build on linux ppc32

hi, i just try to build llvm-3.0 (stable) on linux ppc32 (CRUX PPC 2.7) with
gcc-4.5.3, binutils-2.21.1, glibc-2.12.2 .

As this suggestion:
http://llvm.org/bugs/show_bug.cgi?id=10969
I applied a patch like this one:

--- llvm-3.0.src/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h
2011-07-26 01:24:55.000000000 +0200
+++ llvm-3.0.src/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h
2011-12-02 02:04:06.000000000 +0100
@@ -34,6 +34,10 @@

} // End llvm namespace

+// Generated files will use "namespace PPC". To avoid symbol clash,
+// undefine PPC here. PPC may be predefined on some hosts.
+#undef PPC

I wonder if it shouldn't just be renamed to PowerPC everywhere. It's not
that much longer.

Joerg

Nico,

There is a third place that '#undef PPC' is needed (at the top of
PPCFixupKinds.h). Alternatively, you can run configure with -UPPC in
your CPPFLAGS. I'll try to get this fixed in trunk shortly.

-Hal

> +// Generated files will use "namespace PPC". To avoid symbol clash,
> +// undefine PPC here. PPC may be predefined on some hosts.
> +#undef PPC
> +

I wonder if it shouldn't just be renamed to PowerPC everywhere. It's not
that much longer.

Would we need to change the 'PPC' prefix on all of the file names and
other associated classes too?

-Hal

As prefix it is fine, just the namespace itself is the problem.

Joerg

> > > +// Generated files will use "namespace PPC". To avoid symbol clash,
> > > +// undefine PPC here. PPC may be predefined on some hosts.
> > > +#undef PPC
> > > +
> >
> > I wonder if it shouldn't just be renamed to PowerPC everywhere. It's not
> > that much longer.
>
> Would we need to change the 'PPC' prefix on all of the file names and
> other associated classes too?

As prefix it is fine, just the namespace itself is the problem.

I know, but I want to make sure that no one objects to breaking what
seems to be a convention followed by the other targets.

-Hal

Nico,

There is a third place that '#undef PPC' is needed (at the top of
PPCFixupKinds.h). Alternatively, you can run configure with -UPPC in
your CPPFLAGS. I'll try to get this fixed in trunk shortly.

I just tested this, and I was wrong: passing -UPPC to configure in
CPPFLAGS does not work for some reason. Providing CPPFLAGS=-UPPC as an
argument to make, however, does seem to work.

$ make CPPFLAGS=-UPPC

-Hal

> Nico,
>
> There is a third place that '#undef PPC' is needed (at the top of
> PPCFixupKinds.h). Alternatively, you can run configure with -UPPC in
> your CPPFLAGS. I'll try to get this fixed in trunk shortly.

I just tested this, and I was wrong: passing -UPPC to configure in
CPPFLAGS does not work for some reason. Providing CPPFLAGS=-UPPC as an
argument to make, however, does seem to work.

$ make CPPFLAGS=-UPPC

Unfortunately, this also causes problems. This seems better:

$ make CXX='g++ -UPPC'

(where g++ should be whatever your original CXX was).

-Hal