Fix a llvm16 compilation error accepted/tizen_9.0_unified accepted/tizen_unified accepted/tizen_unified_dev tizen_9.0 accepted/tizen/9.0/unified/20241030.235235 accepted/tizen/unified/20240223.064455 accepted/tizen/unified/dev/20240620.010609 tizen_9.0_m2_release
authorYonghong Song <yhs@fb.com>
Thu, 27 Oct 2022 16:05:53 +0000 (09:05 -0700)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 22 Feb 2024 14:17:55 +0000 (15:17 +0100)
With latest llvm16, I got the following build errors:
  ...
  /.../bcc/build/src/cc/libbcc.so: undefined reference to
    `llvm::hlsl::FrontendResource::FrontendResource(llvm::GlobalVariable*,
     llvm::StringRef, llvm::hlsl::ResourceKind, unsigned int, unsigned int)'
  collect2: error: ld returned 1 exit status
  make[2]: *** [tests/cc/CMakeFiles/test_libbcc.dir/build.make:371: tests/cc/test_libbcc] Error 1
  ...

The reason is due to llvm upsteam patch https://reviews.llvm.org/D135110
which added llvm library FrontendHLSL as a dependency to clang CodeGen library.
So we need to add it as well for non-shared library build mode.

Signed-off-by: Yonghong Song <yhs@fb.com>
cmake/clang_libs.cmake

index f855c6f8065cd08942425524a4fe4212002f108a..fe82f2fba94e84ea731bc157f4cefeb391285033 100644 (file)
@@ -25,6 +25,10 @@ endif()
 if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 15 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 15)
   list(APPEND llvm_raw_libs windowsdriver)
 endif()
+if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 16 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 16)
+  list(APPEND llvm_raw_libs frontendhlsl)
+endif()
+
 llvm_map_components_to_libnames(_llvm_libs ${llvm_raw_libs})
 llvm_expand_dependencies(llvm_libs ${_llvm_libs})
 endif()