blob: 21d2f81b5800dcb3fbbb977148f960c95e81adf6 [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From 2f8ea767afdaa440c6368040630e1b3ea6a0977a Mon Sep 17 00:00:00 2001
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002From: Martin Kelly <mkelly@xevo.com>
3Date: Fri, 19 May 2017 00:22:57 -0700
4Subject: [PATCH 2/2] 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
11Signed-off-by: Martin Kelly <mkelly@xevo.com>
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14Upstream-Status: Pending
15
16 tools/llvm-config/llvm-config.cpp | 7 +++++++
17 1 file changed, 7 insertions(+)
18
19diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
20index 08b096afb05..d8d7742744e 100644
21--- a/tools/llvm-config/llvm-config.cpp
22+++ b/tools/llvm-config/llvm-config.cpp
23@@ -225,6 +225,13 @@ Typical components:\n\
24
25 /// \brief Compute the path to the main executable.
26 std::string GetExecutablePath(const char *Argv0) {
27+ // Hack for Yocto: we need to override the root path when we are using
28+ // llvm-config from within a target sysroot.
29+ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH");
30+ if (Sysroot != nullptr) {
31+ return Sysroot;
32+ }
33+
34 // This just needs to be some symbol in the binary; C++ doesn't
35 // allow taking the address of ::main however.
36 void *P = (void *)(intptr_t)GetExecutablePath;
37--
Brad Bishop316dfdd2018-06-25 12:45:53 -0400382.16.1
Brad Bishopd7bf8c12018-02-25 22:55:05 -050039