Skip to content

Commit

Permalink
Merge pull request #245 from nathanchance/update-distribution-components
Browse files Browse the repository at this point in the history
Adjust distribution components style and fix building with PGO
  • Loading branch information
nathanchance authored Oct 3, 2023
2 parents 59a3a88 + 2711ccd commit 203b23e
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions tc_build/llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,18 +372,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 @@ -395,10 +406,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 @@ -413,8 +420,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

0 comments on commit 203b23e

Please sign in to comment.