From 710c81cc329112ae96220f793136622397de089e Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Mon, 2 Oct 2023 15:25:55 +0200 Subject: [PATCH] llvm: Avoid looking at /proc/self/exe LLVM looks at /proc/self/exe to determine which binary has been called. This does not work with the proposed changes for termux-exec: https://github.com/termux/termux-exec/pull/24 Luckily the fallback to look at argv0 works instead. --- packages/libllvm/build.sh | 2 +- .../llvm-lib-Support-Unix-Path.inc.patch | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 packages/libllvm/llvm-lib-Support-Unix-Path.inc.patch diff --git a/packages/libllvm/build.sh b/packages/libllvm/build.sh index 89bff35c5a1f76..622d54670280cc 100644 --- a/packages/libllvm/build.sh +++ b/packages/libllvm/build.sh @@ -5,7 +5,7 @@ TERMUX_PKG_LICENSE_FILE="llvm/LICENSE.TXT" TERMUX_PKG_MAINTAINER="@finagolfin" LLVM_MAJOR_VERSION=16 TERMUX_PKG_VERSION=${LLVM_MAJOR_VERSION}.0.6 -TERMUX_PKG_REVISION=2 +TERMUX_PKG_REVISION=3 TERMUX_PKG_SHA256=ce5e71081d17ce9e86d7cbcfa28c4b04b9300f8fb7e78422b1feb6bc52c3028e TERMUX_PKG_AUTO_UPDATE=false TERMUX_PKG_SRCURL=https://github.com/llvm/llvm-project/releases/download/llvmorg-$TERMUX_PKG_VERSION/llvm-project-$TERMUX_PKG_VERSION.src.tar.xz diff --git a/packages/libllvm/llvm-lib-Support-Unix-Path.inc.patch b/packages/libllvm/llvm-lib-Support-Unix-Path.inc.patch new file mode 100644 index 00000000000000..5d190d894cb8e3 --- /dev/null +++ b/packages/libllvm/llvm-lib-Support-Unix-Path.inc.patch @@ -0,0 +1,19 @@ +diff -u -r ../orig-src/llvm/lib/Support/Unix/Path.inc ./llvm/lib/Support/Unix/Path.inc +--- ../orig-src/llvm/lib/Support/Unix/Path.inc 2023-09-29 21:36:47.056335287 +0000 ++++ ./llvm/lib/Support/Unix/Path.inc 2023-09-29 21:40:31.091417185 +0000 +@@ -252,6 +252,7 @@ + return exe_path; + #elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__) + char exe_path[PATH_MAX]; ++#ifndef __ANDROID__ /* Avoid looking at /proc/self/exe, as it does not work with termux-exec linker wrapping */ + const char *aPath = "/proc/self/exe"; + if (sys::fs::exists(aPath)) { + // /proc is not always mounted under Linux (chroot for example). +@@ -280,6 +281,7 @@ + return std::string(real_path); + #endif + } ++#endif + // Fall back to the classical detection. + if (getprogpath(exe_path, argv0)) + return exe_path;