[compiler-rt] [compiler-rt][lit] Check glibc without external packages (PR #158387)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 12 17:51:16 PDT 2025
https://github.com/aeubanks created https://github.com/llvm/llvm-project/pull/158387
Alternative to #158236 without requiring external packages
>From f6d4005e3d4abdebc7c191c3f0fcaa138418926f Mon Sep 17 00:00:00 2001
From: Arthur Eubanks <aeubanks at google.com>
Date: Sat, 13 Sep 2025 00:48:37 +0000
Subject: [PATCH] [compiler-rt][lit] Check glibc without external packages
Alternative to #158236 without requiring external packages
---
compiler-rt/test/lit.common.cfg.py | 33 +++++++++++++-----------------
1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index e2e815444dcf9..bbc022127d60d 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -708,27 +708,22 @@ def get_macos_aligned_version(macos_vers):
config.substitutions.append(("%push_to_device", "echo "))
config.substitutions.append(("%adb_shell", "echo "))
-if config.target_os == "Linux":
- def add_glibc_versions(ver_string):
- if config.android:
- return
-
- from distutils.version import LooseVersion
-
- ver = LooseVersion(ver_string)
+if config.target_os == "Linux" and not config.android:
+ def add_glibc_versions(major, minor):
any_glibc = False
for required in [
- "2.19",
- "2.27",
- "2.30",
- "2.33",
- "2.34",
- "2.37",
- "2.38",
- "2.40",
+ (2, 19),
+ (2, 27),
+ (2, 30),
+ (2, 33),
+ (2, 34),
+ (2, 37),
+ (2, 38),
+ (2, 40),
]:
- if ver >= LooseVersion(required):
- config.available_features.add("glibc-" + required)
+ if (major, minor) >= required:
+ (required_major, required_minor) = required
+ config.available_features.add(f"glibc-{required_major}.{required_minor}")
any_glibc = True
if any_glibc:
config.available_features.add("glibc")
@@ -754,7 +749,7 @@ def add_glibc_versions(ver_string):
try:
sout, _ = cmd.communicate(b"#include <features.h>")
m = dict(re.findall(r"#define (__GLIBC__|__GLIBC_MINOR__) (\d+)", str(sout)))
- add_glibc_versions(f"{m['__GLIBC__']}.{m['__GLIBC_MINOR__']}")
+ add_glibc_versions(int(m['__GLIBC__']), int(m['__GLIBC_MINOR__']))
except:
pass
More information about the llvm-commits
mailing list