[LLVMdev] llvm-gcc4 & mingw32

Chris Lattner sabre at nondot.org
Wed May 24 10:19:11 PDT 2006


On Thu, 11 May 2006, Anton Korobeynikov wrote:
> 1.5 Patches to LLVM source code and GCC source code (attached).

Hi, Sorry, I didn't notice that there were patches attached to this email 
:(

Here are some feedback on the patches.  The LLVM one in particular looks 
like this.  Comments below are prefixed with ***.

============================================================
--- configure	155956256e89ce3f97692ea550e612f23b20c9a5
+++ configure	35f342fc281c8107ea3b3e6b7a4c67748e9818da
@@ -3150,10 +3150,10 @@
  fi;
  case "$withval" in
    default) WITH_LLVMGCCDIR=default ;;
-  /*)      WITH_LLVMGCCDIR=$withval ;;
-  *) { { echo "$as_me:$LINENO: error: Invalid path for --with-llvmgccdir. Provide full path" >&5
-echo "$as_me: error: Invalid path for --with-llvmgccdir. Provide full path" >&2;}
-   { (exit 1); exit 1; }; } ;;
+  *)      WITH_LLVMGCCDIR=$withval ;;
+#  *) { { echo "$as_me:$LINENO: error: Invalid path for --with-llvmgccdir. Provide full path" >&5
+#echo "$as_me: error: Invalid path for --with-llvmgccdir. Provide full path" >&2;}
+#   { (exit 1); exit 1; }; } ;;
  esac

*** I'm not sure what this does, but it seems that you should be modifying 
configure.ac, not configure itself.  It's quite possible this is obsolete 
with the other patches of yours that have gone in.

============================================================
--- examples/Makefile	2ceb866a00384348771cb6cbea5ef37c5ec049f2
+++ examples/Makefile	fd1fd2b481e9390712d31222e14ca73f8311da4c
@@ -11,6 +11,6 @@
  include $(LEVEL)/Makefile.config

  #PARALLEL_DIRS:= $(patsubst %/Makefile,%,$(wildcard $(SourceDir)/*/Makefile))
-PARALLEL_DIRS:= ParallelJIT Fibonacci HowToUseJIT ModuleMaker BFtoLLVM
+PARALLEL_DIRS:= Fibonacci HowToUseJIT ModuleMaker BFtoLLVM

*** This isn't suitable for mainline, it disables the program for all 
targets.  Try something like this:

include $(LEVEL)/Makefile.config
ifeq($OS,Win32)
PARALLEL_DIRS := $(filter-out ParallelJIT, $(PARALLEL_DIRS))
endif

Also, please include a comment as to why this is disabled.  If it's lack 
of threading stuff, that should just be a matter of implementing the right 
pieces in libsystem.

  include $(LEVEL)/Makefile.common
============================================================
--- lib/CodeGen/AsmPrinter.cpp	4d087f1319aa4dfebaaa1e60a31c472e3ac73f95
+++ lib/CodeGen/AsmPrinter.cpp	ef7057d8945842dc2c79cd4c6ff355925233f48c
@@ -50,8 +50,13 @@
    MLSections(false),
    ConstantPoolSection("\t.section .rodata\n"),
    JumpTableSection("\t.section .rodata\n"),
+#ifndef __MINGW32__
    StaticCtorsSection("\t.section .ctors,\"aw\", at progbits"),
    StaticDtorsSection("\t.section .dtors,\"aw\", at progbits"),
+#else
+  StaticCtorsSection("\t.section .ctors,\"aw\""),
+  StaticDtorsSection("\t.section .dtors,\"aw\""),
+#endif
    LCOMMDirective(0),
    COMMDirective("\t.comm\t"),
    COMMDirectiveTakesAlignment(true),

This isn't the right approach to take.  Instead of modifying 
target-independent code, you should be modifying the backend.  Also, 
instead of using #ifndef __MINGW32__, you should be checking 
X86Subtarget::TargetType, so that this works in cross compiles.

============================================================
--- lib/Target/X86/X86ATTAsmPrinter.cpp	8322d2abc8060ad351cb91560a0217e76273e502
+++ lib/Target/X86/X86ATTAsmPrinter.cpp	6a01b8b87d60c49fb4f4159d936abfcd2a210388
@@ -64,7 +64,11 @@
      } else {
        EmitAlignment(4, F);     // FIXME: This should be parameterized somewhere.
        O << "\t.section\t.llvm.linkonce.t." << CurrentFnName
+#ifndef __MINGW32__
          << ",\"ax\", at progbits\n";
+#else
+        << ",\"ax\"\n";
+#endif
        O << "\t.weak " << CurrentFnName << "\n";
      }
      break;

*** Same as above, please check the subtarget.

============================================================
--- lib/Target/X86/X86AsmPrinter.cpp	56794abbf644ef81639885abd8c9d00088ccf333
+++ lib/Target/X86/X86AsmPrinter.cpp	c1c961dc23dffd5cb7c7367af2b65a01bd384b10
@@ -128,8 +128,10 @@
            } else
              O << COMMDirective  << name << "," << Size;
          } else {
+#if !defined(__MINGW32__)
            if (I->hasInternalLinkage())
              O << "\t.local\t" << name << "\n";
+#endif
            O << COMMDirective  << name << "," << Size;
            if (COMMDirectiveTakesAlignment)
              O << "," << (AlignmentIsInBytes ? (1 << Align) : Align);
@@ -145,7 +147,11 @@
              << "\t.weak_definition " << name << "\n";
            SwitchSection(".section __DATA,__datacoal_nt,coalesced", I);
          } else {
+#ifndef __MINGW32__
            O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\", at progbits\n";
+#else
+          O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\"\n";
+#endif
            O << "\t.weak " << name << "\n";
          }
          break;

*** Same as above, please check the subtarget.

-Chris

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




More information about the llvm-dev mailing list