0009-clang-Prepend-trailing-to-sysroot.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From ef6d2733699177e973abced7e6045b95b39caf76 Mon Sep 17 00:00:00 2001
  2. From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  3. Date: Tue, 9 Nov 2021 10:10:37 +0800
  4. Subject: [PATCH 09/34] clang: Prepend trailing '/' to sysroot
  5. This is needed to handle a case where clang
  6. isntall and target sysroot are perilously same
  7. e.g.
  8. sysroot = /mnt/clang/recipe-sysroot
  9. clang install = /mnt/clang/recipe-sysroot-native
  10. in this case it will mistakenly assume that
  11. clang is installed under the same sysroot dir
  12. and it will try to add relative ../lib paths
  13. to linker steps which would then be wrong
  14. since they will become relative to clang
  15. installation and not sysroot
  16. Rebased to LLVM 14.0.0 by Jun Yuan Tan
  17. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  18. Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  19. ---
  20. clang/lib/Driver/ToolChains/Linux.cpp | 2 +-
  21. 1 file changed, 1 insertion(+), 1 deletion(-)
  22. diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
  23. index b7165be9a7a6..9fe4e5230045 100644
  24. --- a/clang/lib/Driver/ToolChains/Linux.cpp
  25. +++ b/clang/lib/Driver/ToolChains/Linux.cpp
  26. @@ -181,7 +181,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
  27. Multilibs = GCCInstallation.getMultilibs();
  28. SelectedMultilib = GCCInstallation.getMultilib();
  29. llvm::Triple::ArchType Arch = Triple.getArch();
  30. - std::string SysRoot = computeSysRoot();
  31. + std::string SysRoot = computeSysRoot() + "/";
  32. ToolChain::path_list &PPaths = getProgramPaths();
  33. Generic_GCC::PushPPaths(PPaths);
  34. --
  35. 2.33.1