[PATCH] D34018: Support __float128 on NetBSD libstdc++ x86/x86_64

Kamil Rytarowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 7 16:54:46 PDT 2017


krytarowski created this revision.

This adds support for __float128 from GNU libstdc++ with Clang on NetBSD x86/x86_64 targets.

This corrects compilation at least of CMake and probably others like Firefox.

In file included from /tmp/pkgsrc-tmp/devel/cmake/work/cmake-3.8.2/Source/kwsys/Directory.cxx:4:
In file included from /tmp/pkgsrc-tmp/devel/cmake/work/cmake-3.8.2/Source/cmsys/Directory.hxx:8:
In file included from /usr/include/g++/string:40:
In file included from /usr/include/g++/bits/char_traits.h:39:
In file included from /usr/include/g++/bits/stl_algobase.h:64:
In file included from /usr/include/g++/bits/stl_pair.h:59:
In file included from /usr/include/g++/bits/move.h:57:
/usr/include/g++/type_traits:311:39: error: __float128 is not supported on this target

  struct __is_floating_point_helper<__float128>
                                    ^

Sponsored by <The NetBSD Foundation>


Repository:
  rL LLVM

https://reviews.llvm.org/D34018

Files:
  lib/Basic/Targets.cpp


Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -514,6 +514,8 @@
     Builder.defineMacro("__ELF__");
     if (Opts.POSIXThreads)
       Builder.defineMacro("_REENTRANT");
+    if (this->HasFloat128)
+      Builder.defineMacro("__FLOAT128__");
 
     switch (Triple.getArch()) {
     default:
@@ -530,6 +532,15 @@
   NetBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
       : OSTargetInfo<Target>(Triple, Opts) {
     this->MCountName = "_mcount";
+
+    switch (Triple.getArch()) {
+    default:
+      break;
+    case llvm::Triple::x86:
+    case llvm::Triple::x86_64:
+      this->HasFloat128 = true;
+      break;
+    }
   }
 };
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34018.101842.patch
Type: text/x-patch
Size: 763 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170607/4226cfe8/attachment-0001.bin>


More information about the cfe-commits mailing list