[PATCH] D11349: Add Support for the cygwin64 target

Martell Malone martellmalone at gmail.com
Mon Jul 20 02:53:36 PDT 2015


martell created this revision.
martell added reviewers: yaron.keren, rnk.
martell added a subscriber: cfe-commits.
martell set the repository for this revision to rL LLVM.

Add a basic to use for when building for cygwin on x86_64

Repository:
  rL LLVM

http://reviews.llvm.org/D11349

Files:
  tools/clang/lib/Basic/Targets.cpp

Index: tools/clang/lib/Basic/Targets.cpp
===================================================================
--- tools/clang/lib/Basic/Targets.cpp
+++ tools/clang/lib/Basic/Targets.cpp
@@ -3992,6 +3992,31 @@
   }
 };
 
+// x86-64 Cygwin target
+class CygwinX86_64TargetInfo : public X86_64TargetInfo {
+public:
+  CygwinX86_64TargetInfo(const llvm::Triple &Triple)
+      : X86_64TargetInfo(Triple) {
+    TLSSupported = false;
+    WCharType = UnsignedShort;
+  }
+  void getTargetDefines(const LangOptions &Opts,
+                        MacroBuilder &Builder) const override {
+    X86_32TargetInfo::getTargetDefines(Opts, Builder);
+    Builder.defineMacro("__x86_64__");
+    Builder.defineMacro("__CYGWIN__");
+    Builder.defineMacro("__CYGWIN64__");
+    addCygMingDefines(Opts, Builder);
+    DefineStd(Builder, "unix", Opts);
+    if (Opts.CPlusPlus)
+      Builder.defineMacro("_GNU_SOURCE");
+
+    // GCC defines this macro when it is using __gxx_personality_seh0.
+    if (!Opts.SjLjExceptions)
+      Builder.defineMacro("__SEH__");
+  }
+};
+
 class DarwinX86_64TargetInfo : public DarwinTargetInfo<X86_64TargetInfo> {
 public:
   DarwinX86_64TargetInfo(const llvm::Triple &Triple)
@@ -7397,6 +7422,8 @@
       return new SolarisTargetInfo<X86_64TargetInfo>(Triple);
     case llvm::Triple::Win32: {
       switch (Triple.getEnvironment()) {
+      case llvm::Triple::Cygnus:
+        return new CygwinX86_64TargetInfo(Triple);
       case llvm::Triple::GNU:
         return new MinGWX86_64TargetInfo(Triple);
       case llvm::Triple::MSVC:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11349.30139.patch
Type: text/x-patch
Size: 1558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150720/40e19557/attachment.bin>


More information about the cfe-commits mailing list