beignet-1.3.2-static-llvm.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. Description: Statically link to libllvm
  2. When multiple ICDs are installed, libopencl1 needs to dlopen() them all
  3. to find out which one works on the available hardware. If they are
  4. dynamically linked, this leads to them sharing a libllvm, which has
  5. enough global state that this is likely to error out. (This is a known
  6. LLVM bug, https://bugs.llvm.org/show_bug.cgi?id=22952 , but currently
  7. has no real fix.)
  8. Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
  9. Bug: https://bugs.llvm.org/show_bug.cgi?id=30587
  10. Bug-Debian: https://bugs.debian.org/852746
  11. Forwarded: https://lists.freedesktop.org/archives/beignet/2019-January/009226.html
  12. --- a/CMake/FindLLVM.cmake
  13. +++ b/CMake/FindLLVM.cmake
  14. @@ -87,18 +87,34 @@ execute_process(
  15. OUTPUT_STRIP_TRAILING_WHITESPACE
  16. )
  17. +if (LLVM_VERSION_NODOT VERSION_GREATER 38)
  18. +execute_process(
  19. + COMMAND ${LLVM_CONFIG_EXECUTABLE} --libs --link-static
  20. + OUTPUT_VARIABLE LLVM_MODULE_LIBS
  21. + OUTPUT_STRIP_TRAILING_WHITESPACE
  22. +)
  23. +else (LLVM_VERSION_NODOT VERSION_GREATER 38)
  24. execute_process(
  25. COMMAND ${LLVM_CONFIG_EXECUTABLE} --libs
  26. OUTPUT_VARIABLE LLVM_MODULE_LIBS
  27. OUTPUT_STRIP_TRAILING_WHITESPACE
  28. )
  29. +endif (LLVM_VERSION_NODOT VERSION_GREATER 38)
  30. if (LLVM_VERSION_NODOT VERSION_GREATER 34)
  31. +if (LLVM_VERSION_NODOT VERSION_GREATER 38)
  32. +execute_process(
  33. + COMMAND ${LLVM_CONFIG_EXECUTABLE} --system-libs --link-static
  34. + OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_ORIG
  35. + OUTPUT_STRIP_TRAILING_WHITESPACE
  36. +)
  37. +else (LLVM_VERSION_NODOT VERSION_GREATER 38)
  38. execute_process(
  39. COMMAND ${LLVM_CONFIG_EXECUTABLE} --system-libs
  40. OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_ORIG
  41. OUTPUT_STRIP_TRAILING_WHITESPACE
  42. )
  43. +endif (LLVM_VERSION_NODOT VERSION_GREATER 38)
  44. if (LLVM_SYSTEM_LIBS_ORIG)
  45. string(REGEX REPLACE " *\n" "" LLVM_SYSTEM_LIBS ${LLVM_SYSTEM_LIBS_ORIG})
  46. endif (LLVM_SYSTEM_LIBS_ORIG)