0002-llvm-allow-env-override-of-exe-path.patch 1.3 KB

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