jhuber6 updated this revision to Diff 299672.
jhuber6 added a comment.

Changing test to be similar to LLVM's method, checks the linker flags for 
32-bit library and only if the target triple is one of the known 64-bit triples.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89696/new/

https://reviews.llvm.org/D89696

Files:
  clang/test/lit.cfg.py
  clang/test/lit.site.cfg.py.in


Index: clang/test/lit.site.cfg.py.in
===================================================================
--- clang/test/lit.site.cfg.py.in
+++ clang/test/lit.site.cfg.py.in
@@ -31,6 +31,7 @@
 config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', 
"@USE_Z3_SOLVER@")
 config.has_plugins = @LLVM_ENABLE_PLUGINS@
 config.clang_vendor_uti = "@CLANG_VENDOR_UTI@"
+config.host_ldflags = '@HOST_LDFLAGS@'
 
 # Support substitution of the tools and libs dirs with user parameters. This is
 # used when we can't determine the tool dir at configuration time.
Index: clang/test/lit.cfg.py
===================================================================
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -1,7 +1,6 @@
 # -*- Python -*-
 
 import os
-import sys
 import platform
 import re
 import subprocess
@@ -168,11 +167,14 @@
 if platform.system() not in ['Windows']:
     config.available_features.add('can-remove-opened-file')
 
-# Check 64-bit host
-if sys.maxsize > 2**32:
+# Features
+known_arches = ["x86_64", "mips64", "ppc64", "aarch64"]
+if (config.host_ldflags.find("-m32") < 0
+    and any(config.host_triple.startswith(x) for x in known_arches)):
   config.available_features.add("clang-64-bits")
 
 
+
 def calculate_arch_features(arch_string):
     features = []
     for arch in arch_string.split():


Index: clang/test/lit.site.cfg.py.in
===================================================================
--- clang/test/lit.site.cfg.py.in
+++ clang/test/lit.site.cfg.py.in
@@ -31,6 +31,7 @@
 config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@")
 config.has_plugins = @LLVM_ENABLE_PLUGINS@
 config.clang_vendor_uti = "@CLANG_VENDOR_UTI@"
+config.host_ldflags = '@HOST_LDFLAGS@'
 
 # Support substitution of the tools and libs dirs with user parameters. This is
 # used when we can't determine the tool dir at configuration time.
Index: clang/test/lit.cfg.py
===================================================================
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -1,7 +1,6 @@
 # -*- Python -*-
 
 import os
-import sys
 import platform
 import re
 import subprocess
@@ -168,11 +167,14 @@
 if platform.system() not in ['Windows']:
     config.available_features.add('can-remove-opened-file')
 
-# Check 64-bit host
-if sys.maxsize > 2**32:
+# Features
+known_arches = ["x86_64", "mips64", "ppc64", "aarch64"]
+if (config.host_ldflags.find("-m32") < 0
+    and any(config.host_triple.startswith(x) for x in known_arches)):
   config.available_features.add("clang-64-bits")
 
 
+
 def calculate_arch_features(arch_string):
     features = []
     for arch in arch_string.split():
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to