blob: 9be26677a9820c03d956177ee385d09418cc36b0 [file] [log] [blame]
Andrew Geisslerd159c7f2021-09-02 21:05:58 -05001From 7111770e8290082530d920e120995bf81431b0aa Mon Sep 17 00:00:00 2001
2From: Martin Kelly <mkelly@xevo.com>
3Date: Fri, 19 May 2017 00:22:57 -0700
4Subject: [PATCH 12/18] llvm: allow env override of exe path
5
6When using a native llvm-config from inside a sysroot, we need llvm-config to
7return the libraries, include directories, etc. from inside the sysroot rather
8than from the native sysroot. Thus provide an env override for calling
9llvm-config from a target sysroot.
10
Andrew Geissler595f6302022-01-24 19:11:47 +000011Upstream-Status: Inappropriate [oe-core specific]
Andrew Geisslerd159c7f2021-09-02 21:05:58 -050012Signed-off-by: Martin Kelly <mkelly@xevo.com>
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14---
15 llvm/tools/llvm-config/llvm-config.cpp | 7 +++++++
16 1 file changed, 7 insertions(+)
17
18--- a/llvm/tools/llvm-config/llvm-config.cpp
19+++ b/llvm/tools/llvm-config/llvm-config.cpp
20@@ -226,6 +226,13 @@ Typical components:\n\
21
22 /// Compute the path to the main executable.
23 std::string GetExecutablePath(const char *Argv0) {
24+ // Hack for Yocto: we need to override the root path when we are using
25+ // llvm-config from within a target sysroot.
26+ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH");
27+ if (Sysroot != nullptr) {
28+ return Sysroot;
29+ }
30+
31 // This just needs to be some symbol in the binary; C++ doesn't
32 // allow taking the address of ::main however.
33 void *P = (void *)(intptr_t)GetExecutablePath;