0002-libcxxabi-Find-libunwind-headers-when-LIBCXXABI_LIBU.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From ec494876174df1ca3f3ca21577796914848bc1ee Mon Sep 17 00:00:00 2001
  2. From: Jun Yuan Tan <junyuan.tan@starfivetech.com>
  3. Date: Fri, 22 Oct 2021 11:14:13 +0800
  4. Subject: [PATCH] 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 | 21 +++++++++++----------
  16. 1 file changed, 11 insertions(+), 10 deletions(-)
  17. diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
  18. index cc1c395b14d1..91174d19bca7 100644
  19. --- a/libcxxabi/CMakeLists.txt
  20. +++ b/libcxxabi/CMakeLists.txt
  21. @@ -522,14 +522,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBCXXABI_C_FLAGS}")
  22. # Setup Source Code
  23. #===============================================================================
  24. -set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
  25. - "Specify path to libunwind includes." FORCE)
  26. -set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
  27. - "Specify path to libunwind source." FORCE)
  28. -
  29. include_directories(include)
  30. if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
  31. - find_path(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL libunwind.h
  32. + find_path(LIBCXXABI_LIBUNWIND_INCLUDES libunwind.h
  33. PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES}
  34. ${LIBCXXABI_LIBUNWIND_PATH}/include
  35. ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES}
  36. @@ -540,15 +535,21 @@ if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM)
  37. NO_CMAKE_FIND_ROOT_PATH
  38. )
  39. - if (LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL-NOTFOUND")
  40. - set(LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL "")
  41. + if (LIBCXXABI_LIBUNWIND_INCLUDES STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES-NOTFOUND")
  42. + set(LIBCXXABI_LIBUNWIND_INCLUDES "")
  43. endif()
  44. - if (NOT LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL STREQUAL "")
  45. - include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}")
  46. + if (NOT LIBCXXABI_LIBUNWIND_INCLUDES STREQUAL "")
  47. + include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES}")
  48. endif()
  49. endif()
  50. +set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
  51. + "Specify path to libunwind includes." FORCE)
  52. +set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH
  53. + "Specify path to libunwind source." FORCE)
  54. +
  55. +
  56. # Add source code. This also contains all of the logic for deciding linker flags
  57. # soname, etc...
  58. add_subdirectory(src)
  59. --
  60. 2.33.0