[libcxx-commits] [PATCH] D88027: [libcxx] Add platforms and targets to available features.

Daniel Kiss via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 21 08:43:33 PDT 2020


danielkiss created this revision.
danielkiss added reviewers: libc++, libc++abi, libunwind.
Herald added subscribers: libcxx-commits, fedor.sergeev.
Herald added a project: libc++.
Herald added 1 blocking reviewer(s): libc++.
danielkiss requested review of this revision.

This patch add the system-* and target-* (x86_64-) as used elsewhere in llvm.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88027

Files:
  libcxx/utils/libcxx/test/config.py


Index: libcxx/utils/libcxx/test/config.py
===================================================================
--- libcxx/utils/libcxx/test/config.py
+++ libcxx/utils/libcxx/test/config.py
@@ -9,6 +9,7 @@
 import copy
 import os
 import pkgutil
+import platform
 import pipes
 import re
 import shlex
@@ -245,8 +246,8 @@
         # XFAIL markers for tests that are known to fail with versions of
         # libc++ as were shipped with a particular triple.
         if self.use_system_cxx_lib:
-            (arch, vendor, platform) = self.config.target_triple.split('-', 2)
-            (sysname, version) = re.match(r'([^0-9]+)([0-9\.]*)', platform).groups()
+            (arch, vendor, target_platform) = self.config.target_triple.split('-', 2)
+            (sysname, version) = re.match(r'([^0-9]+)([0-9\.]*)', target_platform).groups()
 
             self.config.available_features.add('with_system_cxx_lib={}-{}-{}{}'.format(arch, vendor, sysname, version))
             self.config.available_features.add('with_system_cxx_lib={}{}'.format(sysname, version))
@@ -266,6 +267,43 @@
             self.config.available_features.add('libcxx_gdb')
             self.cxx.libcxx_gdb = libcxx_gdb
 
+        if platform.system() == 'Darwin':
+            self.config.available_features.add('system-linker-mach-o')
+            self.config.available_features.add('system-darwin')
+        elif platform.system() == 'Windows':
+            self.config.available_features.add('system-windows')
+        elif platform.system() == 'Linux':
+            self.config.available_features.add('system-linux')
+        elif platform.system() == 'FreeBSD':
+            self.config.available_features.add('system-freebsd')
+        elif platform.system() == 'NetBSD':
+            self.config.available_features.add('system-netbsd')
+        elif platform.system() == 'AIX':
+            self.config.available_features.add('system-aix')
+        elif platform.system() == 'SunOS':
+            self.config.available_features.add('system-solaris')
+
+        # Native compilation: host arch == default triple arch
+        host_triple = getattr(self.config, 'host_triple', None)
+        target_triple = getattr(self.config, 'target_triple', None)
+        if host_triple and host_triple == target_triple:
+            self.config.available_features.add('native')
+
+        if target_triple:
+            if re.match(r'^x86_64.*-apple', target_triple):
+                self.config.available_features.add('x86_64-apple')
+            if re.match(r'^x86_64.*-linux', target_triple):
+                self.config.available_features.add('x86_64-linux')
+            if re.match(r'^i.86.*', target_triple):
+                self.config.available_features.add('target-x86')
+            elif re.match(r'^x86_64.*', target_triple):
+                self.config.available_features.add('target-x86_64')
+            elif re.match(r'^aarch64.*', target_triple):
+                self.config.available_features.add('target-aarch64')
+            elif re.match(r'^arm.*', target_triple):
+                self.config.available_features.add('target-arm')
+
+
     def configure_compile_flags(self):
         self.configure_default_compile_flags()
         # Configure extra flags


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88027.293184.patch
Type: text/x-patch
Size: 3250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200921/fe2ad89e/attachment.bin>


More information about the libcxx-commits mailing list