MinGW-w64 runtime library inclusion (Clang-compiled) for proper Win64 support?

kink noone at nowhere.com
Sat Jun 22 12:24:22 PDT 2013


I've got to say that I'm not keen on working further on this. I 
got rid of the linking issues, but the library is surely not 100% 
functional. My changes to the MinGW-w64 CRT are a messy hack, and 
that's because the codebase itself is a mess, very ugly and 
partially from the 80s and 90s of the last century.

I'd really suggest mapping the real type to the double type for 
Windows targets, ideally in all D compilers of course.

Here's at least the tiny patch for Clang to enable 80-bit long 
double support on Win64:

diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 4968938..f6ac502 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -3229,8 +3229,8 @@ class VisualStudioWindowsX86_64TargetInfo : 
public WindowsX86_64TargetInfo {
  public:
    VisualStudioWindowsX86_64TargetInfo(const std::string& triple)
      : WindowsX86_64TargetInfo(triple) {
-    LongDoubleWidth = LongDoubleAlign = 64;
-    LongDoubleFormat = &llvm::APFloat::IEEEdouble;
+    //LongDoubleWidth = LongDoubleAlign = 64;
+    //LongDoubleFormat = &llvm::APFloat::IEEEdouble;
    }
    virtual void getTargetDefines(const LangOptions &Opts,
                                  MacroBuilder &Builder) const {
diff --git a/lib/CodeGen/TargetInfo.cpp 
b/lib/CodeGen/TargetInfo.cpp
index 4fa0c3b..9fb00a5 100644
--- a/lib/CodeGen/TargetInfo.cpp
+++ b/lib/CodeGen/TargetInfo.cpp
@@ -2584,6 +2584,11 @@ ABIArgInfo 
WinX86_64ABIInfo::classify(QualType Ty, bool IsReturnType) const {
    if (Ty->isPromotableIntegerType())
      return ABIArgInfo::getExtend();

+  if (!IsReturnType &&                                        // 
regular function parameter
+      Ty->isRealFloatingType() && Size > 64 &&                // 
non-complex x87 type (80 bits)
+      getTarget().getTriple().getOS() == llvm::Triple::Win32) // 
Win64 Visual Studio target
+    return ABIArgInfo::getIndirect(0, /*ByVal=*/false);       // 
TODO: is that the right ByVal setting?
+
    return ABIArgInfo::getDirect();
  }


More information about the digitalmars-d-ldc mailing list