0002-libcxxabi-Find-libunwind-headers-when.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From 2b467f98cd2a1d6521bcebf6068412d6416c1b0d Mon Sep 17 00:00:00 2001
  2. From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  3. Date: Tue, 9 Nov 2021 09:58:40 +0800
  4. Subject: [PATCH 02/34] libcxxabi: Find libunwind headers when
  5. LIBCXXABI_LIBUNWIND_INCLUDES is set
  6. Currently, when LIBCXXABI_LIBUNWIND_INCLUDES is set via CMake arguments
  7. then it ends up not searching the specified dir and unwind.h is not found
  8. especially for ARM targets
  9. This patch makes the searching synthesized directories and then set
  10. LIBCXXABI_LIBUNWIND_INCLUDES if its there in environment
  11. Rebased to LLVM 14.0.0 by Jun Yuan Tan
  12. Signed-off-by: Khem Raj <raj.khem@gmail.com>
  13. Signed-off-by: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  14. ---
  15. libcxxabi/CMakeLists.txt | 16 +++++++++++-----
  16. 1 file changed, 11 insertions(+), 5 deletions(-)
  17. diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
  18. index cee2aa675d9c..23c127d831f3 100644
  19. --- a/libcxxabi/CMakeLists.txt
  20. +++ b/libcxxabi/CMakeLists.txt
  21. @@ -523,7 +523,7 @@ set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
  22. include_directories(include)
  23. if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
  24. - find_path(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL libunwind.h
  25. + find_path(LIBCXXABI_LIBUNWIND_INCLUDES libunwind.h
  26. PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
  27. ${LIBCXXABI_LIBUNWIND_PATH}/include
  28. ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
  29. @@ -534,15 +534,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
  30. NO_CMAKE_FIND_ROOT_PATH
  31. )
  32. - if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND")
  33. - set(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL "")
  34. + if (LIBCXXABI_LIBUNWIND_INCLUDES STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES-NOTFOUND")
  35. + set(LIBCXXABI_LIBUNWIND_INCLUDES "")
  36. endif()
  37. - if (NOT LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "")
  38. - include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}")
  39. + if (NOT LIBCXXABI_LIBUNWIND_INCLUDES STREQUAL "")
  40. + include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES}")
  41. endif()
  42. endif()
  43. +set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
  44. + "Specify path to libunwind includes." FORCE)
  45. +set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
  46. + "Specify path to libunwind source." FORCE)
  47. +
  48. +
  49. # Add source code. This also contains all of the logic for deciding linker flags
  50. # soname, etc...
  51. add_subdirectory(src)
  52. --
  53. 2.33.1