Skip to content

Commit 7018832

Browse files
committed
Update toolchain binaries. Add linux compiler-rt on non-linux hosts.
1 parent 22fb290 commit 7018832

File tree

7 files changed

+88
-52
lines changed

7 files changed

+88
-52
lines changed

.github/workflows/bazel_impl.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ on:
2020
jobs:
2121

2222
test-bazel-rules:
23-
if: ${{ inputs.use-built-toolchain == true || contains(inputs.target, 'musl') == false }}
2423
name: test ${{ inputs.target }} target on ${{ inputs.host }} host
2524
runs-on: ${{ inputs.runs-on }}
2625
steps:

.github/workflows/cmake_impl.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ on:
2020
jobs:
2121

2222
test-cmake-rules:
23-
if: ${{ inputs.use-built-toolchain == true || contains(inputs.target, 'musl') == false }}
2423
name: test ${{ inputs.target }} target on ${{ inputs.host }} host
2524
runs-on: ${{ inputs.runs-on }}
2625
steps:

bazel/detail/assets/assets.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
[
22
{
33
"name": "compiler-rt-linux",
4-
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/compiler-rt-linux.tar.xz",
5-
"integrity": "sha256-B3b7+hKQEBbuts0ooMIDRKePGmpOFUeoumKH18icPrA="
4+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/compiler-rt-linux.tar.xz",
5+
"integrity": "sha256-TLoykNTnpEpYsEVVoHECqJ9ybuCeYoMwoX3nC9nskhc="
66
},
77
{
88
"name": "llvm-aarch64-unknown-linux-gnu",
9-
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/llvm-aarch64-unknown-linux-gnu.tar.xz",
10-
"integrity": "sha256-mxFQjNjwTwnhBbV4Bpl50Wf9sEzdPjUqtrZ1c45/vog="
9+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/llvm-aarch64-unknown-linux-gnu.tar.xz",
10+
"integrity": "sha256-BVeVsUUW/sPqrj2xqfnp6pqMwg5xuwBV/ysRiCxsCE0="
1111
},
1212
{
1313
"name": "llvm-arm64-apple-macos",
14-
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/llvm-arm64-apple-macos.tar.xz",
15-
"integrity": "sha256-6QyZv5HFHxpyV4qCSym3kOeBIEa4qL22RhVDXu8KT/w="
14+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/llvm-arm64-apple-macos.tar.xz",
15+
"integrity": "sha256-P6+DbQfFPvBdDBIMNc0ICtbJSOPPKuAxX/oo2x0pZ24="
1616
},
1717
{
1818
"name": "llvm-x86_64-apple-macos",
19-
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/llvm-x86_64-apple-macos.tar.xz",
20-
"integrity": "sha256-AWN2TNvX6vTMKxbvcQ6hh/4ayyHZm2Ujv2bZY9ShJgs="
19+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/llvm-x86_64-apple-macos.tar.xz",
20+
"integrity": "sha256-szuhV23mQRobymsx+nJcLfRxv4/JCIXburuwAc6U7gc="
2121
},
2222
{
2323
"name": "llvm-x86_64-pc-windows-msvc",
24-
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/llvm-x86_64-pc-windows-msvc.tar.xz",
25-
"integrity": "sha256-skiZ7gh04LQUSfNYNk3WAvKiZiVn2AoIKF8WFI+6Fzg="
24+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/llvm-x86_64-pc-windows-msvc.tar.xz",
25+
"integrity": "sha256-qN8yjRWgvgXhhmogHKaL+KBHdJr4+y3rvC4ZjZW2R0c="
2626
},
2727
{
2828
"name": "llvm-x86_64-unknown-linux-gnu",
29-
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/llvm-x86_64-unknown-linux-gnu.tar.xz",
30-
"integrity": "sha256-HKRrFb1GvwfO1lZhGVvfcPUhPe+5AIDBzyLuzV/HHb4="
29+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/llvm-x86_64-unknown-linux-gnu.tar.xz",
30+
"integrity": "sha256-dysPWCy5yEYyKgBH0OX8YBKnHNh1yYcCWkMUP7MworE="
3131
},
3232
{
3333
"name": "sysroot-aarch64-unknown-linux-gnu",
34-
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/sysroot-aarch64-unknown-linux-gnu.tar.xz",
35-
"integrity": "sha256-aK7IJ3cYMa1/COZtfSRegnTZZufVAeFikoJ8y4aSMdQ="
34+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/sysroot-aarch64-unknown-linux-gnu.tar.xz",
35+
"integrity": "sha256-cIqyCo4dLUTxG3ymb2uJGLW7NdjvLNoI2yvJZ7rniLI="
3636
},
3737
{
3838
"name": "sysroot-aarch64-unknown-linux-musl",
39-
"url": "bootstrap",
40-
"integrity": "sha256-aK7IJ3cYMa1/COZtfSRegnTZZufVAeFikoJ8y4aSMdQ="
39+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/sysroot-aarch64-unknown-linux-musl.tar.xz",
40+
"integrity": "sha256-8ZFZV5nRZMbsmQMWX63sxtUpJoOALw0hl10QN0fFdYk="
4141
},
4242
{
4343
"name": "sysroot-armv7-unknown-linux-gnueabihf",
44-
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/sysroot-armv7-unknown-linux-gnueabihf.tar.xz",
45-
"integrity": "sha256-B0wWloN2MW8odF3H0GMrXtJPT2O9GHaThmRc2WT9bq8="
44+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/sysroot-armv7-unknown-linux-gnueabihf.tar.xz",
45+
"integrity": "sha256-AKHUNEUdmkskqLDx8HCdawCwnhHkCZ2ZDeHc7retpPU="
4646
},
4747
{
4848
"name": "sysroot-x86_64-unknown-linux-gnu",
49-
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/sysroot-x86_64-unknown-linux-gnu.tar.xz",
50-
"integrity": "sha256-C/nLgvYsxC7lKr+r5Z06OdSZqaYUMIuRB74KEuKE4Gk="
49+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/sysroot-x86_64-unknown-linux-gnu.tar.xz",
50+
"integrity": "sha256-hKmT9FZTw7RY2OwTv0XAWhaTNIrDdnRPt1A5AAYLyVA="
5151
},
5252
{
5353
"name": "sysroot-x86_64-unknown-linux-musl",
54-
"url": "bootstrap",
55-
"integrity": "sha256-C/nLgvYsxC7lKr+r5Z06OdSZqaYUMIuRB74KEuKE4Gk="
54+
"url": "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/sysroot-x86_64-unknown-linux-musl.tar.xz",
55+
"integrity": "sha256-W15hGFCCFrUNVjSc6BABJtMjzxAe+Mapv8qeVQHeyjE="
5656
}
57-
]
57+
]
Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,33 @@
1-
set(_ASSET_URL_compiler-rt-linux "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/compiler-rt-linux.tar.xz")
2-
set(_ASSET_SHA256_compiler-rt-linux 0776fbfa12901016eeb6cd28a0c20344a78f1a6a4e1547a8ba6287d7c89c3eb0)
1+
set(_ASSET_URL_compiler-rt-linux "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/compiler-rt-linux.tar.xz")
2+
set(_ASSET_SHA256_compiler-rt-linux 4cba3290d4e7a44a58b04555a07102a89f726ee09e628330a17de70bd9ec9217)
33

4-
set(_ASSET_URL_llvm-aarch64-unknown-linux-gnu "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/llvm-aarch64-unknown-linux-gnu.tar.xz")
5-
set(_ASSET_SHA256_llvm-aarch64-unknown-linux-gnu 9b11508cd8f04f09e105b578069979d167fdb04cdd3e352ab6b675738e7fbe88)
4+
set(_ASSET_URL_llvm-aarch64-unknown-linux-gnu "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/llvm-aarch64-unknown-linux-gnu.tar.xz")
5+
set(_ASSET_SHA256_llvm-aarch64-unknown-linux-gnu 055795b14516fec3eaae3db1a9f9e9ea9a8cc20e71bb0055ff2b11882c6c084d)
66

7-
set(_ASSET_URL_llvm-arm64-apple-macos "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/llvm-arm64-apple-macos.tar.xz")
8-
set(_ASSET_SHA256_llvm-arm64-apple-macos e90c99bf91c51f1a72578a824b29b790e7812046b8a8bdb64615435eef0a4ffc)
7+
set(_ASSET_URL_llvm-arm64-apple-macos "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/llvm-arm64-apple-macos.tar.xz")
8+
set(_ASSET_SHA256_llvm-arm64-apple-macos 3faf836d07c53ef05d0c120c35cd080ad6c948e3cf2ae0315ffa28db1d29676e)
99

10-
set(_ASSET_URL_llvm-x86_64-apple-macos "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/llvm-x86_64-apple-macos.tar.xz")
11-
set(_ASSET_SHA256_llvm-x86_64-apple-macos 0163764cdbd7eaf4cc2b16ef710ea187fe1acb21d99b6523bf66d963d4a1260b)
10+
set(_ASSET_URL_llvm-x86_64-apple-macos "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/llvm-x86_64-apple-macos.tar.xz")
11+
set(_ASSET_SHA256_llvm-x86_64-apple-macos b33ba1576de6411a1bca6b31fa725c2df471bf8fc90885dbbabbb001ce94ee07)
1212

13-
set(_ASSET_URL_llvm-x86_64-pc-windows-msvc "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/llvm-x86_64-pc-windows-msvc.tar.xz")
14-
set(_ASSET_SHA256_llvm-x86_64-pc-windows-msvc b24899ee0874e0b41449f358364dd602f2a2662567d80a08285f16148fba1738)
13+
set(_ASSET_URL_llvm-x86_64-pc-windows-msvc "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/llvm-x86_64-pc-windows-msvc.tar.xz")
14+
set(_ASSET_SHA256_llvm-x86_64-pc-windows-msvc a8df328d15a0be05e1866a201ca68bf8a047749af8fb2debbc2e198d95b64747)
1515

16-
set(_ASSET_URL_llvm-x86_64-unknown-linux-gnu "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/llvm-x86_64-unknown-linux-gnu.tar.xz")
17-
set(_ASSET_SHA256_llvm-x86_64-unknown-linux-gnu 1ca46b15bd46bf07ced65661195bdf70f5213defb90080c1cf22eecd5fc71dbe)
16+
set(_ASSET_URL_llvm-x86_64-unknown-linux-gnu "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/llvm-x86_64-unknown-linux-gnu.tar.xz")
17+
set(_ASSET_SHA256_llvm-x86_64-unknown-linux-gnu 772b0f582cb9c846322a0047d0e5fc6012a71cd875c987025a43143fb330a2b1)
1818

19-
set(_ASSET_URL_sysroot-aarch64-unknown-linux-gnu "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/sysroot-aarch64-unknown-linux-gnu.tar.xz")
20-
set(_ASSET_SHA256_sysroot-aarch64-unknown-linux-gnu 68aec827771831ad7f08e66d7d245e8274d966e7d501e16292827ccb869231d4)
19+
set(_ASSET_URL_sysroot-aarch64-unknown-linux-gnu "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/sysroot-aarch64-unknown-linux-gnu.tar.xz")
20+
set(_ASSET_SHA256_sysroot-aarch64-unknown-linux-gnu 708ab20a8e1d2d44f11b7ca66f6b8918b5bb35d8ef2cda08db2bc967bae788b2)
2121

22-
set(_ASSET_URL_sysroot-armv7-unknown-linux-gnueabihf "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/sysroot-armv7-unknown-linux-gnueabihf.tar.xz")
23-
set(_ASSET_SHA256_sysroot-armv7-unknown-linux-gnueabihf 074c16968376316f28745dc7d0632b5ed24f4f63bd18769386645cd964fd6eaf)
22+
set(_ASSET_URL_sysroot-aarch64-unknown-linux-musl "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/sysroot-aarch64-unknown-linux-musl.tar.xz")
23+
set(_ASSET_SHA256_sysroot-aarch64-unknown-linux-musl f191595799d164c6ec9903165fadecc6d5292683802f0d21975d103747c57589)
2424

25-
set(_ASSET_URL_sysroot-x86_64-unknown-linux-gnu "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.21/sysroot-x86_64-unknown-linux-gnu.tar.xz")
26-
set(_ASSET_SHA256_sysroot-x86_64-unknown-linux-gnu 0bf9cb82f62cc42ee52abfabe59d3a39d499a9a614308b9107be0a12e284e069)
25+
set(_ASSET_URL_sysroot-armv7-unknown-linux-gnueabihf "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/sysroot-armv7-unknown-linux-gnueabihf.tar.xz")
26+
set(_ASSET_SHA256_sysroot-armv7-unknown-linux-gnueabihf 00a1d434451d9a4b24a8b0f1f0709d6b00b09e11e4099d990de1dceeb7ada4f5)
27+
28+
set(_ASSET_URL_sysroot-x86_64-unknown-linux-gnu "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/sysroot-x86_64-unknown-linux-gnu.tar.xz")
29+
set(_ASSET_SHA256_sysroot-x86_64-unknown-linux-gnu 84a993f45653c3b458d8ec13bf45c05a1693348ac376744fb7503900060bc950)
30+
31+
set(_ASSET_URL_sysroot-x86_64-unknown-linux-musl "https://github.com/CACI-International/cpp-toolchain/releases/download/toolchain-2025.07.27/sysroot-x86_64-unknown-linux-musl.tar.xz")
32+
set(_ASSET_SHA256_sysroot-x86_64-unknown-linux-musl 5b5e6118508216b50d56349ce8100126d323cf101ef8c6a9bfca9e5501deca31)
2733

cmake/portable_cc_toolchain/private/download.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,16 @@ function(download location asset variable)
6363
else()
6464
set(_url "${_ASSET_URL_${asset}}")
6565
set(_sha "${_ASSET_SHA256_${asset}}")
66+
set(_download_dir "${_out}")
67+
if(asset MATCHES "compiler-rt")
68+
# CMake removes single top level directories, but we don't want that here
69+
set(_download_dir "${_out}/lib")
70+
endif()
6671
FetchContent_Declare(
6772
${asset}
6873
URL "${_url}"
6974
URL_HASH "SHA256=${_sha}"
70-
SOURCE_DIR "${_out}"
75+
SOURCE_DIR "${_download_dir}"
7176
${DOWNLOAD_ARGS}
7277
)
7378
FetchContent_MakeAvailable(${asset})

cmake/portable_cc_toolchain/toolchain.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ endif()
7070
download(_llvm_dir "llvm-${_host_triple}" PORTABLE_CC_TOOLCHAIN_LLVM)
7171
if("${TARGET_TRIPLE}" MATCHES "linux")
7272
download(_sysroot_dir "sysroot-${TARGET_TRIPLE}" PORTABLE_CC_TOOLCHAIN_SYSROOT)
73+
if(NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
74+
download(_compiler_rt_dir "compiler-rt-linux" PORTABLE_CC_TOOLCHAIN_COMPILER_RT_LINUX)
75+
set(_overlay_dir "${CMAKE_BINARY_DIR}/_portable_cc_toolchain/llvm-overlay-${_host_triple}")
76+
file(MAKE_DIRECTORY "${_overlay_dir}")
77+
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${_llvm_dir}" "${_compiler_rt_dir}" "${_overlay_dir}")
78+
set(_llvm_dir "${_overlay_dir}")
79+
endif()
7380
endif()
7481

7582

cmake/test/CMakeLists.txt

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,32 @@ project(Test)
1313

1414
enable_testing()
1515

16-
if(NOT ${CMAKE_CROSSCOMPILING} AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
16+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
17+
# asan currently only works in release mode
18+
add_compile_options(
19+
$<$<CONFIG:Release>:-fsanitize=undefined,address>
20+
$<$<CONFIG:Release>:/Oy->
21+
)
22+
# lld-link doesn't have -fsanitize
23+
cmake_path(GET CMAKE_C_COMPILER PARENT_PATH llvm_bin_dir)
24+
string(REGEX MATCH "^([0-9]+)" clang_major_version ${CMAKE_C_COMPILER_VERSION})
25+
set(runtime_dir "${llvm_bin_dir}/../lib/clang/${clang_major_version}/lib/${TARGET_TRIPLE}")
26+
link_directories("${runtime_dir}")
27+
link_libraries(
28+
$<$<CONFIG:Release>:clang_rt.ubsan_standalone_cxx>
29+
$<$<CONFIG:Release>:clang_rt.asan_dynamic>
30+
$<$<CONFIG:Release>:clang_rt.asan_dynamic_runtime_thunk>
31+
)
32+
elseif(TARGET_TRIPLE MATCHES "musl")
33+
# asan doesn't support static linking
1734
add_compile_options($<$<CONFIG:Debug>:-fsanitize=undefined>)
1835
add_link_options($<$<CONFIG:Debug>:-fsanitize=undefined>)
19-
if(TARGET_TRIPLE MATCHES "gnu")
20-
add_compile_options($<$<CONFIG:Debug>:-fsanitize=address>)
21-
add_compile_options($<$<CONFIG:Debug>:-fno-omit-frame-pointer>)
22-
add_link_options($<$<CONFIG:Debug>:-fsanitize=address>)
23-
add_compile_options($<$<CONFIG:Debug>:-fsanitize=leak>)
24-
add_link_options($<$<CONFIG:Debug>:-fsanitize=leak>)
25-
endif()
36+
else()
37+
add_compile_options(
38+
$<$<CONFIG:Debug>:-fsanitize=undefined,address,leak>
39+
$<$<CONFIG:Debug>:-fno-omit-frame-pointer>
40+
)
41+
add_link_options($<$<CONFIG:Debug>:-fsanitize=undefined,address,leak>)
2642
endif()
2743

2844
if(TARGET_TRIPLE MATCHES "musl")
@@ -37,6 +53,10 @@ function(make_test name main)
3753
target_link_libraries(${name} PRIVATE Foo)
3854
if(NOT ${CMAKE_CROSSCOMPILING})
3955
add_test(NAME "${name}Test" COMMAND ${name})
56+
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
57+
file(REAL_PATH "${runtime_dir}" runtime_dir_absolute)
58+
set_tests_properties("${name}Test" PROPERTIES ENVIRONMENT "PATH=${runtime_dir_absolute};$ENV{PATH}")
59+
endif()
4060
endif()
4161
endfunction()
4262

0 commit comments

Comments
 (0)