Skip to content
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

Adjust distribution components style and fix building with PGO #245

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions tc_build/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,18 +362,29 @@ def configure(self):
'CLANG_PLUGIN_SUPPORT': 'OFF',
}

llvm_build_runtime = self.cmake_defines.get('LLVM_BUILD_RUNTIME', 'ON') == 'ON'
build_compiler_rt = self.project_is_enabled('compiler-rt') and llvm_build_runtime

distribution_components = [
'clang',
'clang-resource-headers',
'lld',
'llvm-ar',
'llvm-nm',
'llvm-objcopy',
'llvm-objdump',
'llvm-ranlib',
'llvm-readelf',
'llvm-strip',
]
if self.project_is_enabled('bolt'):
distribution_components.append('bolt')
if build_compiler_rt:
distribution_components += ['llvm-profdata', 'profile']

slim_llvm_defines = {
# Tools needed by bootstrapping
'LLVM_DISTRIBUTION_COMPONENTS': ';'.join(['clang',
'clang-resource-headers',
'lld',
'llvm-ar',
'llvm-nm',
'llvm-ranlib',
'llvm-objcopy',
'llvm-objdump',
'llvm-readelf',
'llvm-strip']),
'LLVM_DISTRIBUTION_COMPONENTS': ';'.join(distribution_components),
# Don't build bindings; they are for other languages that the kernel does not use
'LLVM_ENABLE_BINDINGS': 'OFF',
# Don't build Ocaml documentation
Expand All @@ -385,10 +396,6 @@ def configure(self):
# Don't include example build targets to save on cmake cycles
'LLVM_INCLUDE_EXAMPLES': 'OFF',
}
if self.project_is_enabled('bolt'):
slim_llvm_defines['LLVM_DISTRIBUTION_COMPONENTS'] += ';bolt'
if self.project_is_enabled('compiler-rt'):
slim_llvm_defines['LLVM_DISTRIBUTION_COMPONENTS'] += ';llvm-profdata;profile'

slim_compiler_rt_defines = {
# Don't build libfuzzer when compiler-rt is enabled, it invokes cmake again and we don't use it
Expand All @@ -403,8 +410,7 @@ def configure(self):
self.cmake_defines.update(slim_llvm_defines)
if self.project_is_enabled('clang'):
self.cmake_defines.update(slim_clang_defines)
if self.project_is_enabled('compiler-rt') and self.cmake_defines.get(
'LLVM_BUILD_RUNTIME', 'ON') == 'ON':
if build_compiler_rt:
self.cmake_defines.update(slim_compiler_rt_defines)

super().configure()
Expand Down