Hello,

I'm the developer of Darling, a translation layer for running OS X
binaries on Linux.

I'm facing many difficulties due to the following differences in i386
ABI between Darwin and Linux:

* size_t on Darwin/i386 is 'unsigned long', but Linux/i386 uses
'unsigned int' (=> different mangled names).
* long double on Darwin/i386 is 128 bits long, but Linux/i386 uses only
96 bits.

This problem can be overcome by specifying '-target
i386-unknown-darwin-elf', but this currently fails due to a different
data layout string (Darwin specifies Mach-O).

The attached patch allows the use of ELF with the DarwinI386 target. It
is identical to what is already done in the WindowsX86_32 target.

Pretty please, include my patch, as it would be very helpful and it's a
rather small change.

Thanks,
-- 
Luboš Doležel
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp	(revision 255459)
+++ lib/Basic/Targets.cpp	(working copy)
@@ -3730,7 +3730,12 @@
       UseSignedCharForObjCBool = false;
     SizeType = UnsignedLong;
     IntPtrType = SignedLong;
-    DataLayoutString = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128";
+
+    bool IsMachO =
+        getTriple().isOSDarwin() && getTriple().isOSBinFormatMachO();
+    DescriptionString = IsMachO
+                            ? "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"
+                            : "e-m:e-p:32:32-f64:32:64-f80:128-n8:16:32-S128";
     HasAlignMac68kSupport = true;
   }
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to