Skip to content

[ATfL][build] Have the clang binary bolted#832

Open
pawosm-arm wants to merge 1 commit intoarm-softwarefrom
users/pawosm-arm/atfl-clang-bolted
Open

[ATfL][build] Have the clang binary bolted#832
pawosm-arm wants to merge 1 commit intoarm-softwarefrom
users/pawosm-arm/atfl-clang-bolted

Conversation

@pawosm-arm
Copy link
Copy Markdown
Contributor

This patch tries to reuse the available stage2 mechanism for bolting the clang binary. As the currently available mechanism has its limitations, we had to introduce a lot of glue in order to make it certain that the effective clang binary is functionally the same as the one we were shipping thus far. Also we wanted it to be linked against the prebuilt libc++ binary.

Some of the points to notice:

  • Currently clang with the assertions turned on cannot be bolted; subject to ongoing investigation.

  • To make it easier to inject our CMake settings into the BOLT.cmake file, they had to be rearranged into several BASH associative arrays.

  • The stage2 build has no install target and no proper testing target, therefore the bolted clang binary replaces the one produced in the product_build stage, and then it participates in the check-all round of tests.

  • The COMMON_CMAKE_FLAGS variable should not be passed to the build.sh script anymore. A check for this has been added.

@pawosm-arm pawosm-arm requested a review from a team as a code owner April 16, 2026 17:13
@pawosm-arm pawosm-arm force-pushed the users/pawosm-arm/atfl-clang-bolted branch from 004afc5 to 3e38929 Compare April 16, 2026 17:15
This patch tries to reuse the available stage2 mechanism for bolting
the clang binary. As the currently available mechanism has its
limitations, we had to introduce a lot of glue in order to make it
certain that the effective clang binary is functionally the same as
the one we were shipping thus far. Also we wanted it to be linked
against the prebuilt libc++ binary.

Some of the points to notice:

- Currently clang with the assertions turned on cannot be bolted;
  subject to ongoing investigation.

- To make it easier to inject our CMake settings into the BOLT.cmake
  file, they had to be rearranged into several BASH associative
  arrays.

- The stage2 build has no install target and no proper testing target,
  therefore the bolted clang binary replaces the one produced in the
  product_build stage, and then it participates in the check-all round
  of tests.

- The COMMON_CMAKE_FLAGS variable should not be passed to the build.sh
  script anymore. A check for this has been added.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the ATfL Linux build script to reuse LLVM’s existing stage2 (PGO/BOLT) mechanism to produce a bolted clang binary, ensuring it matches the previously shipped behavior and links against the prebuilt libc++.

Changes:

  • Add a product_bolted stage that builds a bolted clang via the stage2/PGO+BOLT cache mechanism, and swaps it into product_build prior to check-all and install.
  • Refactor CMake configuration from positional arrays into multiple bash associative arrays and generate -C flags.cmake cache files to inject settings consistently across stages.
  • Fail early if the obsolete COMMON_CMAKE_FLAGS environment variable is set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


print_forced_cmake_flags_cache()
{
declare -A arr="${1#*=}"

mkdir -p "${BUILD_DIR}/stage/product_bolted"
cd "${BUILD_DIR}/stage/product_bolted"
mkdir cmake-caches
run_command cmake --build . ${CMAKE_BUILD_ARGS} 2>&1 | tee -a "${LOGS_DIR}/product.txt"
if [[ "${ATFL_ASSERTIONS}" == "OFF" ]]; then
local clang_name
clang_name="$(readlink bin/clang)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants