Group :: Development/C
RPM: llvm12.0
Main Changelog Spec Patches Sources Download Gear Bugs and FR Repocop
Patch: 0001-alt-llvm-config-Ignore-wrappers-when-looking-for-current.patch
Download
Download
From febc3e5c7bb8502775add342c33c221af9e87a50 Mon Sep 17 00:00:00 2001
From: Arseny Maslennikov <arseny@altlinux.org>
Date: Thu, 19 Nov 2020 11:39:51 +0300
Subject: [PATCH] llvm-config: Ignore wrappers when looking for current
executable path
In ALT, tools are installed into their own prefix and bindir, and the
respective paths in /usr/bin are symlinked to a small wrapper program
which can call different versions of the requested tool depending on its
environment.
When /proc/self/exe is not available, the executable is looked up in
PATH, which usually includes /usr/bin and excludes /usr/lib/llvm-*/bin.
We forgo the path to wrapper at /usr/bin/$tool and use
/usr/lib/llvm-%v_majmin/bin/$tool instead.
---
llvm/lib/Support/Unix/Path.inc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index d91b269cc..b409a8611 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -174,6 +174,12 @@ getprogpath(char ret[PATH_MAX], const char *bin)
for (char *t = strtok_r(s, ":", &state); t != nullptr;
t = strtok_r(nullptr, ":", &state)) {
if (test_dir(ret, t, bin) == 0) {
+ /* An ALT-specific exception: if found in /usr/bin, this is a wrapper
+ * and the real binary is in /usr/lib/llvm-%v_majmin/bin.
+ */
+ if (!strncmp(ret, "/usr/bin/llvm-alt-tool-wrapper", strlen("/usr/bin/llvm-alt-tool-wrapper"))) {
+ snprintf(ret, PATH_MAX, "%s/%s", "%llvm_bindir", bin);
+ }
free(s);
return ret;
}
--
2.25.4