[llvm] [BOLT][NFC] Using target_triple in lit config (PR #144078)

Paschalis Mpeis via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 13 08:03:10 PDT 2025


https://github.com/paschalis-mpeis updated https://github.com/llvm/llvm-project/pull/144078

>From 55284564381aab27dd486163fda04529a9675aac Mon Sep 17 00:00:00 2001
From: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
Date: Fri, 13 Jun 2025 14:24:59 +0100
Subject: [PATCH 1/2] [BOLT][NFC] Using target_triple in lit config

---
 bolt/test/lit.local.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bolt/test/lit.local.cfg b/bolt/test/lit.local.cfg
index d5a6849b27a77..77e19c9f34bad 100644
--- a/bolt/test/lit.local.cfg
+++ b/bolt/test/lit.local.cfg
@@ -1,4 +1,4 @@
-host_linux_triple = config.target_triple.split("-")[0] + "-unknown-linux-gnu"
+host_linux_triple = config.target_triple
 common_linker_flags = "-fuse-ld=lld -Wl,--unresolved-symbols=ignore-all -Wl,--build-id=none -pie"
 flags = f"--target={host_linux_triple} -fPIE {common_linker_flags}"
 

>From 525ee97bebf26ffdc37ba24b2f8f35f6fac843a9 Mon Sep 17 00:00:00 2001
From: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
Date: Fri, 13 Jun 2025 16:01:43 +0100
Subject: [PATCH 2/2] Addressing reviewers

---
 bolt/test/lit.local.cfg | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/bolt/test/lit.local.cfg b/bolt/test/lit.local.cfg
index 77e19c9f34bad..d1a109497b251 100644
--- a/bolt/test/lit.local.cfg
+++ b/bolt/test/lit.local.cfg
@@ -1,6 +1,12 @@
-host_linux_triple = config.target_triple
+host_triple = config.target_triple
+
+# Force triple on non-linux hosts to get ELF binaries on all platforms.
+if not "linux" in host_triple:
+  arch = host_triple.split("-")[0]
+  host_triple = arch+"-unknown-linux-gnu"
+
 common_linker_flags = "-fuse-ld=lld -Wl,--unresolved-symbols=ignore-all -Wl,--build-id=none -pie"
-flags = f"--target={host_linux_triple} -fPIE {common_linker_flags}"
+flags = f"--target={host_triple} -fPIE {common_linker_flags}"
 
 config.substitutions.insert(0, ("%cflags", f"%cflags {flags}"))
 config.substitutions.insert(0, ("%cxxflags", f"%cxxflags {flags}"))



More information about the llvm-commits mailing list