[LLVMdev] [patch] Fix problems with build LLVM using gcc 4.1.0 (gcc CVS mainline)

Chris Lattner sabre at nondot.org
Sun Oct 23 22:04:32 PDT 2005


On Mon, 24 Oct 2005, Vladimir A. Merzliakov wrote:
> I have some problems with build current CVS version LLVM using GCC 4.1.0 (GCC 
> CVS mainline version).

Thanks!

> 1) Build terminate with error:
>
> llvm[3]: Compiling SparcV8CodeEmitter.cpp for Debug build
> /usr/home/wanderer/pkg/build/llvm/obj/lib/Target/SparcV8/SparcV8GenCodeEmitter.inc:11: 
> error: definition of 'unsigned int

Patch applied:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20051017/028993.html

> 2) Same error but some diff. problem with AlphaCodeEmitter.cpp and 
> PPCCodeEmitter.cpp:
>
> GCC don't like definition member-functions in global namespace with 
> declaration  in llvm::<unnamed> :

Can you try this patch and see if it works?  I'd rather not put the entire 
file in namespace scope like V8:

Index: AlphaCodeEmitter.cpp
===================================================================
RCS file: 
/home/vadve/shared/PublicCVS/llvm/lib/Target/Alpha/AlphaCodeEmitter.cpp,v
retrieving revision 1.6
diff -u -r1.6 AlphaCodeEmitter.cpp
--- AlphaCodeEmitter.cpp        4 Aug 2005 15:32:36 -0000       1.6
+++ AlphaCodeEmitter.cpp        24 Oct 2005 04:57:10 -0000
@@ -72,9 +72,11 @@

  /// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha code
  /// to the specified MCE object.
-FunctionPass *llvm::createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) {
+namespace llvm {
+FunctionPass *createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) {
    return new AlphaCodeEmitter(MCE);
  }
+}

  bool AlphaCodeEmitter::runOnMachineFunction(MachineFunction &MF) {
    II = ((AlphaTargetMachine&)MF.getTarget()).getInstrInfo();

If this works, I'll fix Alpha and PPC.  I'm suprised though that it 
doesn't work and if not, that it only affects these two files.  Maybe I 
don't understand the issue.

> 3) Patch suggested in 
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20051017/028898.html 
> move END_WITH_NULL to before function name.

Looks good, applied:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20051024/028994.html

Thanks!

-Chris

> === Patches ===========================
>
> --- lib/Target/SparcV8/SparcV8CodeEmitter.cpp Mon Oct 24 08:25:17 2005
> +++ lib/Target/SparcV8/SparcV8CodeEmitter.cpp.new Mon Oct 24 03:17:38 2005
> @@ -181,6 +181,6 @@
>  abort();
> }
>
> -#include "SparcV8GenCodeEmitter.inc"
> -
> } // end llvm namespace
> +
> +#include "SparcV8GenCodeEmitter.inc"
>
> --- lib/Target/Alpha/AlphaCodeEmitter.cpp Mon Oct 24 08:25:17 2005
> +++ lib/Target/Alpha/AlphaCodeEmitter.cpp.new Mon Oct 24 07:08:42 2005
> @@ -23,7 +23,8 @@
> #include "llvm/Function.h"
> #include "llvm/Support/Debug.h"
> #include "llvm/ADT/Statistic.h"
> -using namespace llvm;
> +
> +namespace llvm {
>
> namespace {
>  Statistic<>
> @@ -72,7 +73,7 @@
>
> /// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha 
> code
> /// to the specified MCE object.
> -FunctionPass *llvm::createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) {
> +FunctionPass *createAlphaCodeEmitterPass(MachineCodeEmitter &MCE) {
>  return new AlphaCodeEmitter(MCE);
> }
>
> @@ -234,6 +235,7 @@
>  return rv;
> }
>
> +} // end llvm namespace
>
> #include "AlphaGenCodeEmitter.inc"
>
> --- lib/Target/PowerPC/PPCCodeEmitter.cpp Mon Oct 24 08:25:17 2005
> +++ lib/Target/PowerPC/PPCCodeEmitter.cpp.new Mon Oct 24 06:39:29 2005
> @@ -22,7 +22,8 @@
> #include "llvm/CodeGen/MachineInstrBuilder.h"
> #include "llvm/CodeGen/Passes.h"
> #include "llvm/Support/Debug.h"
> -using namespace llvm;
> +
> +namespace llvm {
>
> namespace {
>  class PPCCodeEmitter : public MachineFunctionPass {
> @@ -260,6 +261,8 @@
>
>  return rv;
> }
> +
> +} // end llvm namespace
>
> #include "PPCGenCodeEmitter.inc"
>
> --- include/llvm/Support/CommandLine.h Mon Oct 24 08:25:16 2005
> +++ include/llvm/Support/CommandLine.h.new Mon Oct 24 08:17:09 2005
> @@ -334,13 +334,8 @@
>  }
> };
>
> -// Silly GCC doesn't allow attributes on a function definition.
> template<class DataType>
> -ValuesClass<DataType> values(const char *Arg, DataType Val, const char 
> *Desc,
> -                             ...) END_WITH_NULL;
> -
> -template<class DataType>
> -ValuesClass<DataType> values(const char *Arg, DataType Val, const char 
> *Desc,
> +ValuesClass<DataType> END_WITH_NULL values(const char *Arg, DataType Val, 
> const char *Desc,
>                             ...) {
>    va_list ValueArgs;
>    va_start(ValueArgs, Desc);
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list