Files
TheRock/compiler/amd-llvm/utils/bazel/llvm-project-overlay/llvm/config.bzl
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

126 lines
4.5 KiB
Python

# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
"""Defines variables that use selects to configure LLVM based on platform."""
load(
"//:vars.bzl",
"LLVM_VERSION_MAJOR",
"LLVM_VERSION_MINOR",
"LLVM_VERSION_PATCH",
"PACKAGE_VERSION",
)
def native_arch_defines(arch, triple):
return [
r'LLVM_NATIVE_ARCH=\"{}\"'.format(arch),
"LLVM_NATIVE_ASMPARSER=LLVMInitialize{}AsmParser".format(arch),
"LLVM_NATIVE_ASMPRINTER=LLVMInitialize{}AsmPrinter".format(arch),
"LLVM_NATIVE_DISASSEMBLER=LLVMInitialize{}Disassembler".format(arch),
"LLVM_NATIVE_TARGET=LLVMInitialize{}Target".format(arch),
"LLVM_NATIVE_TARGETINFO=LLVMInitialize{}TargetInfo".format(arch),
"LLVM_NATIVE_TARGETMC=LLVMInitialize{}TargetMC".format(arch),
"LLVM_NATIVE_TARGETMCA=LLVMInitialize{}TargetMCA".format(arch),
r'LLVM_HOST_TRIPLE=\"{}\"'.format(triple),
r'LLVM_DEFAULT_TARGET_TRIPLE=\"{}\"'.format(triple),
]
posix_defines = [
"LLVM_ON_UNIX=1",
"HAVE_BACKTRACE=1",
"BACKTRACE_HEADER=<execinfo.h>",
r'LTDL_SHLIB_EXT=\".so\"',
r'LLVM_PLUGIN_EXT=\".so\"',
"LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS=1",
"LLVM_ENABLE_PLUGINS=1",
"LLVM_ENABLE_THREADS=1",
"HAVE_DEREGISTER_FRAME=1",
"HAVE_LIBPTHREAD=1",
"HAVE_PTHREAD_GETNAME_NP=1",
"HAVE_PTHREAD_H=1",
"HAVE_PTHREAD_SETNAME_NP=1",
"HAVE_REGISTER_FRAME=1",
"HAVE_SETENV_R=1",
"HAVE_STRERROR_R=1",
"HAVE_SYSEXITS_H=1",
"HAVE_SYS_IOCTL_H=1",
"HAVE_UNISTD_H=1",
]
linux_defines = posix_defines + [
"_GNU_SOURCE",
"HAVE_GETAUXVAL=1",
"HAVE_MALLINFO=1",
"HAVE_SBRK=1",
"HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1",
]
macos_defines = posix_defines + [
"HAVE_MACH_MACH_H=1",
"HAVE_MALLOC_MALLOC_H=1",
"HAVE_MALLOC_ZONE_STATISTICS=1",
"HAVE_PROC_PID_RUSAGE=1",
"HAVE_UNW_ADD_DYNAMIC_FDE=1",
]
win32_defines = [
# Windows system library specific defines.
"_CRT_SECURE_NO_DEPRECATE",
"_CRT_SECURE_NO_WARNINGS",
"_CRT_NONSTDC_NO_DEPRECATE",
"_CRT_NONSTDC_NO_WARNINGS",
"_SCL_SECURE_NO_DEPRECATE",
"_SCL_SECURE_NO_WARNINGS",
"UNICODE",
"_UNICODE",
# LLVM features
r'LTDL_SHLIB_EXT=\".dll\"',
r'LLVM_PLUGIN_EXT=\".dll\"',
]
# TODO: We should switch to platforms-based config settings to make this easier
# to express.
os_defines = select({
"@platforms//os:freebsd": posix_defines,
"@platforms//os:macos": macos_defines,
"@platforms//os:windows": win32_defines,
"//conditions:default": linux_defines,
})
# HAVE_BUILTIN_THREAD_POINTER is true for on Linux (outside of ppc64) for
# all recent toolchains. Add it here by default on Linux as we can't perform a
# configure time check.
builtin_thread_pointer = select({
Label("//llvm:linux_ppc64le"): [],
"@platforms//os:linux": ["HAVE_BUILTIN_THREAD_POINTER"],
"//conditions:default": [],
})
# TODO: We should split out host vs. target here.
llvm_config_defines = os_defines + builtin_thread_pointer + select({
Label("//llvm:darwin_arm64"): native_arch_defines("AArch64", "arm64-apple-darwin"),
Label("//llvm:darwin_x86_64"): native_arch_defines("X86", "x86_64-unknown-darwin"),
Label("//llvm:linux_aarch64"): native_arch_defines("AArch64", "aarch64-unknown-linux-gnu"),
Label("//llvm:linux_ppc64le"): native_arch_defines("PowerPC", "powerpc64le-unknown-linux-gnu"),
Label("//llvm:linux_riscv64"): native_arch_defines("RISCV", "riscv64-unknown-linux-gnu"),
Label("//llvm:linux_s390x"): native_arch_defines("SystemZ", "systemz-unknown-linux_gnu"),
"@platforms//os:windows": native_arch_defines("X86", "x86_64-pc-win32"),
"//conditions:default": native_arch_defines("X86", "x86_64-unknown-linux-gnu"),
}) + [
"LLVM_VERSION_MAJOR={}".format(LLVM_VERSION_MAJOR),
"LLVM_VERSION_MINOR={}".format(LLVM_VERSION_MINOR),
"LLVM_VERSION_PATCH={}".format(LLVM_VERSION_PATCH),
r'LLVM_VERSION_STRING=\"{}\"'.format(PACKAGE_VERSION),
# Set globally in HandleLLVMOptions.cmake
# These shouldn't be needed by the C++11 standard, but are for some
# platforms (e.g. glibc < 2.18. See
# https://sourceware.org/bugzilla/show_bug.cgi?id=15366). These are also
# included unconditionally in the CMake build:
# https://github.com/llvm/llvm-project/blob/cd0dd8ece8e/llvm/cmake/modules/HandleLLVMOptions.cmake#L907-L909
"__STDC_LIMIT_MACROS",
"__STDC_CONSTANT_MACROS",
"__STDC_FORMAT_MACROS",
]