-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use llvm-config to fix link error if llvm is pre-built locally static or shared #492
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* [NFC] Improve for options_compile.cpp 1. Check return value for consume_front function 2. Pass by reference to avoid copy StringRef * Apply suggestions
…OR}/ (intel#419) Fedora places llvm include files into that directory instead of assumed ${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}/include/ Try both, fail horribly when none of them exist
…set (intel#413) * Works around windows x86 build if CMAKE_SIZEOF_VOID_P is not set Determine windows binary suffix via LLVM_BUILD_32_BITS in windows x86 if CMAKE_SIZEOF_VOID_P is not set * Apply suggestions
Fixes build issues
Cherry-pick commit 78c5e3f from `ocl-open-140` branch. Omit the Clang patch addition, as https://reviews.llvm.org/D141297 is part of LLVM 16. Signed-off-by: Artem Gindinson <artem.gindinson@intel.com>
cmake macro doesn't create new scope, so it is wrong to set PARENT_SCOPE for CMAKE_CXX_FLAGS. In addition, in out-of-tree build, the parent scope doesn't exist and there is cmake warning.
* Request native clang only when cross-compiling LLVM_USE_HOST_TOOLS may be set if LLVM is configured with LLVM_OPTIMIZED_TABLEGEN, which does not necessarily indicate cross-compilation or that clang will only execute on the target. By checking that CMAKE_CROSSCOMPILING is set, we ensure that we only build/use clang again if necessary for host execution. * fixup: CMAKE_CROSSCOMPILING implies LLVM_USE_HOST_TOOLS Co-authored-by: Wenju He <wenju.he@intel.com> * fixup: also use CMAKE_CROSSCOMPILING in top-level CMakeLists.txt --------- Co-authored-by: Wenju He <wenju.he@intel.com>
opencl-clang only uses clang libraries to generate frontend IR and explicitly disables llvm optimizations. In addition, opencl-clang doesn't parse/print assembly. Therefore, there is no need to initialize llvm target machines, target MCs, asm printers and asm parsers This PR removes opencl-clang's dependency on some llvm libraries.
…n/ModuleManager.h (intel#472)
…l#471) When opencl-clang is used in-tree of a project, these two variables may be defined in CMakeLists.txt of the project. This PR makes the variable names clear that they are intended for opencl-clang library and easily distinguishable from other variables in CMakeLists.txt of the project.
Other dependent clang libraries, e.g. those clangFrontendTool depends, will be automatically added by cmake.
…intel#476) This reverts commit 1bda00e.
The following link error occurs in downstream after 1bda00e: ``` ld: error: undefined symbol: clang::PCHContainerOperations::PCHContainerOperations() >>> referenced by opencl_clang.cpp >>> _deps/opencl-clang-build/CMakeFiles/common_clang.dir/opencl_clang.cpp.o:(Compile) icpx: error: linker command failed with exit code 1 (use -v to see invocation) ``` This is similar to the link error seen in https://reviews.llvm.org/D157078, which was resolved in the same way (https://reviews.llvm.org/rG36daf3532d91bb3e61d631edceea77ebb8417801). This patch just adds 'clangSerialization' to the link libraries to resolve the issue.
Not report undefined symbols when in sanitizer build, sanitizers do not support this flag. With this flag, it will lead to linker errors when trying to build with sanitizers.
Before this PR this build options is ignored by opencl-clang.
haonanya
approved these changes
Oct 7, 2023
wenju-he
changed the title
Fix link error if llvm is pre-built locally static or shared
Use llvm-config to fix link error if llvm is pre-built locally static or shared
Oct 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
llvm_map_components_to_libnames is empty in these cases.
This fixes link error in Ubuntu 22.04 container. #484 and #454
(cherry picked from commit 1cde56c)
(cherry picked from commit 7b62fd8)