From 6a231990271e12426ccca76e6ceeb9aed9ecc3c6 Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Fri, 11 Jul 2025 22:10:07 +0100 Subject: [PATCH 1/9] [ATFE] Package common multilib headers into target triple directory. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current ATFE package redundantly duplicates identical C and C++ headers across more than 100 ibrary variants, despite the fact that these headers do not vary within a given target triple aside from few. As a result, each variant currently maintains its own include/ and include/c++/v1/ directories, leading to unnecessary duplication. This patch is to refactor the multilib layout to use a single shared header directory per target triple, eliminating redundant copies of identical headers across library variants, while keeping variant-specific headers within each variant’s own include/ directory. Changing the layout of the package structure will require corresponding updates to the ATFE build system, as it currently assumes a variant specific directory hierarchy for headers and libraries during installation and packaging. A new Python script has been introduced that runs after the runtime subproject has been executed for each variant and the non-optimised multilib directories have been generated. This script identifies and extracts common headers from the non-optimised multilibs and creates an optimised multilib directory. In this optimised directory, only the common headers are centralised, while the remaining contents are preserved as-is from the non-optimised layout. A CMake flag has been added to disable this multilib optimisation phase. When this flag is set, the optimised multilib directory will not be generated. Additionally, the optimisation step is skipped automatically if there are fewer than two multilib variants to build. To support this new layout with a centralised include directory, a new field called IncludePath has been added to multilib.yaml.This field specifies a base path for locating header files wich gets added to the header search path sequence by clang. Corresponding changes in Clang: https://github.com/llvm/llvm-project/pull/146651 --- arm-software/embedded/CMakeLists.txt | 6 + .../embedded/arm-multilib/CMakeLists.txt | 33 +++- .../arm-multilib/common-headers-generate.py | 159 ++++++++++++++++++ 3 files changed, 194 insertions(+), 4 deletions(-) create mode 100755 arm-software/embedded/arm-multilib/common-headers-generate.py diff --git a/arm-software/embedded/CMakeLists.txt b/arm-software/embedded/CMakeLists.txt index 95e74fdb695c..25680c3a39fa 100644 --- a/arm-software/embedded/CMakeLists.txt +++ b/arm-software/embedded/CMakeLists.txt @@ -180,6 +180,11 @@ option( OFF ) +option( + ENABLE_MULTILIB_HEADER_OPTIMISATION "Enable multilib header optimisation phase" + ON +) + # Previously, the LLVM_TOOLCHAIN_LIBRARY_OVERLAY_INSTALL option was # called LLVM_TOOLCHAIN_NEWLIB_OVERLAY_INSTALL. Detect a setting of # that name, in case it's in an existing CMakeCache.txt or command @@ -646,6 +651,7 @@ if(NOT PREBUILT_TARGET_LIBRARIES) -DLLVM_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}/llvm -DMULTILIB_JSON=${LLVM_TOOLCHAIN_MULTILIB_JSON} -DENABLE_VARIANTS=${ENABLE_VARIANTS_PASSTHROUGH} + -DENABLE_MULTILIB_HEADER_OPTIMISATION=${ENABLE_MULTILIB_HEADER_OPTIMISATION} -DENABLE_PARALLEL_LIB_CONFIG=${ENABLE_PARALLEL_LIB_CONFIG} -DENABLE_PARALLEL_LIB_BUILD=${ENABLE_PARALLEL_LIB_BUILD} -DPARALLEL_LIB_BUILD_LEVELS=${PARALLEL_LIB_BUILD_LEVELS} diff --git a/arm-software/embedded/arm-multilib/CMakeLists.txt b/arm-software/embedded/arm-multilib/CMakeLists.txt index 041ddc30d802..155993312c40 100644 --- a/arm-software/embedded/arm-multilib/CMakeLists.txt +++ b/arm-software/embedded/arm-multilib/CMakeLists.txt @@ -48,6 +48,7 @@ set( fvp/get_fvps.sh" ) set(FVP_CONFIG_DIR "${TOOLCHAIN_SOURCE_DIR}/fvp/config" CACHE STRING "The directory in which the FVP models are installed.") +option(ENABLE_MULTILIB_HEADER_OPTIMISATION "Enable multilib header optimisation phase" ON) option( ENABLE_PARALLEL_LIB_CONFIG "Run the library variant configuration steps in parallel." @@ -185,10 +186,12 @@ foreach(lib_idx RANGE ${lib_count_dec}) set(parent_dir_name arm-none-eabi) endif() set(destination_directory "${CMAKE_CURRENT_BINARY_DIR}/multilib/${parent_dir_name}/${variant}") - install( - DIRECTORY ${destination_directory} - DESTINATION ${parent_dir_name} - ) + if(NOT ENABLE_MULTILIB_HEADER_OPTIMISATION) + install( + DIRECTORY ${destination_directory} + DESTINATION ${parent_dir_name} + ) + endif() set(variant_json_file ${CMAKE_CURRENT_SOURCE_DIR}/json/variants/${variant_json}) # Read info from the variant specific json. @@ -251,6 +254,8 @@ foreach(lib_idx RANGE ${lib_count_dec}) TEST_EXCLUDE_FROM_MAIN TRUE ) + list(APPEND all_runtime_targets runtimes-${variant}) + if(ENABLE_PARALLEL_LIB_CONFIG OR ENABLE_PARALLEL_LIB_BUILD) # Create additional steps to configure/build the subprojects. # These are collected to be run together, so that all the @@ -337,6 +342,9 @@ foreach(lib_idx RANGE ${lib_count_dec}) foreach(flag ${multilib_flags_list}) string(APPEND multilib_yaml_content " - ${flag}\n") endforeach() + string(APPEND multilib_yaml_content " IncludePath:\n") + string(APPEND multilib_yaml_content " - ${parent_dir_name}/include\n") + string(APPEND multilib_yaml_content " - ${parent_dir_name}/${variant}/include\n") string(APPEND multilib_yaml_content " Group: stdlibs\n") else() # In place of a json, an error message is expected. @@ -354,6 +362,7 @@ foreach(lib_idx RANGE ${lib_count_dec}) endforeach() + # Multilib file is generated in two parts. # 1. Template is filled with multilib flags from json configure_file( @@ -390,3 +399,19 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/multilib/multilib.yaml DESTINATION . ) + +# Extract common header files which spans across multilib variant directories. +if(ENABLE_MULTILIB_HEADER_OPTIMISATION) + add_custom_target(generate-multilib-common-headers ALL + COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/common-headers-generate.py" + "${CMAKE_CURRENT_BINARY_DIR}/multilib" + "${CMAKE_CURRENT_BINARY_DIR}/multilib-optimised" + COMMENT "Generating common headers" + DEPENDS ${all_runtime_targets} + ) + + install( + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/multilib-optimised/" + DESTINATION . + ) +endif() diff --git a/arm-software/embedded/arm-multilib/common-headers-generate.py b/arm-software/embedded/arm-multilib/common-headers-generate.py new file mode 100755 index 000000000000..fcaef114b47f --- /dev/null +++ b/arm-software/embedded/arm-multilib/common-headers-generate.py @@ -0,0 +1,159 @@ +#!/usr/bin/env python3 + +""" +Identifies and extracts header files that are common across multiple multilib variant directories. + +This script scans all variant folders within a multilib target directory +(e.g., `arm-none-eabi/variant1/include`, `arm-none-eabi/variant2/include`, etc.) and compares all +`.h` files. If the same file (by name and content) appears in multiple variants, it will be moved +to a shared include directory at: + + /multilib-optimised//include/ + +for the following multilib targets: +- arm-none-eabi +- aarch64-none-elf + +Arguments: + /multilib Path to the CMake build directory containing non optmised multilib. + eg: build/multilib-builds/multilib/picolibc-build/multilib + /multilib-optimised Path to the CMake build directory where optimised multilib should be generated.. + eg: build/multilib-builds/multilib/picolibc-build/multilib-optimised + +This is useful to reduce duplication in the toolchain by centralising common headers +that are shared across architecture variants. +""" +import argparse +import os +import filecmp +import shutil + +# Define the multilib target dirs which want to process +MULTILIB_TARGET_DIRS = ["arm-none-eabi", "aarch64-none-elf"] + + +def files_are_identical(f1, f2): + return filecmp.cmp(f1, f2, shallow=False) + + +def collect_variant_include_paths(input_target_dir): + """ + Extracts each multilib variant and its corresponding include path from the non-optimised multilib directory. + Stores the results to enable later comparison of header contents across different non-optimised multilib variant + include paths. + + """ + variant_include_path = {} + for variant in os.listdir(input_target_dir): + include_path = os.path.join(input_target_dir, variant, "include") + if os.path.isdir(include_path): + variant_include_path[variant] = include_path + return variant_include_path + + +def extract_common_headers_for_targets(args): + for target in MULTILIB_TARGET_DIRS: + input_target_dir = os.path.join( + os.path.abspath(args.multilib_non_optimised_dir), target + ) + output_target_dir = os.path.join( + os.path.abspath(args.multilib_optimised_dir), target + ) + output_include_dir = os.path.join(output_target_dir, "include") + + if not os.path.isdir(input_target_dir): + print( + f"Skipping extracting the common headers for {target}: input path {input_target_dir} not found" + ) + continue + + os.makedirs(output_include_dir, exist_ok=True) + + variant_includes = collect_variant_include_paths(input_target_dir) + if len(variant_includes) < 2: + print( + f"Skipping extracing the common headers for {target}: not enough variants to compare.At least two variants must be enabled for the multilib header optimisation phase to proceed." + ) + return + + # Step 1: compare first two variants and extract the common headers into the targets common include directory + base_dir = list(variant_includes.values())[0] + compare_dir = list(variant_includes.values())[1] + for root, sub_dirs, header_files in os.walk(base_dir): + sub_dir_root = os.path.relpath(root, base_dir) + for header in header_files: + h1 = os.path.join(base_dir, sub_dir_root, header) + h2 = os.path.join(compare_dir, sub_dir_root, header) + if os.path.exists(h2) and files_are_identical(h1, h2): + out_dir = os.path.join(output_include_dir, sub_dir_root) + os.makedirs(out_dir, exist_ok=True) + shutil.copy2(h1, os.path.join(out_dir, header)) + + # Step 2: Compare all the variants with the new common include. Any headers that do not match + # and do not exit in common include should retain in their respective variant specific directories. + for variant, include_path in variant_includes.items(): + for root, sub_dirs, header_files in os.walk(include_path): + sub_dir_root = os.path.relpath(root, include_path) + for header in header_files: + variant_header = os.path.join(include_path, sub_dir_root, header) + common_header = os.path.join( + output_include_dir, sub_dir_root, header + ) + if not os.path.exists(common_header) or not files_are_identical( + variant_header, common_header + ): + out_dir = os.path.join( + os.path.abspath(args.multilib_optimised_dir), + target, + variant, + sub_dir_root, + "include", + ) + os.makedirs(out_dir, exist_ok=True) + shutil.copy2(variant_header, os.path.join(out_dir, header)) + + # Step3: For each variant, the lib and share directories should be copied from the non-optimised multilib + # directory as it is. + for variant in variant_includes: + remaining_dirs = ["lib", "share"] + for folder in remaining_dirs: + src_dir = os.path.join(input_target_dir, variant, folder) + dst_dir = os.path.join(output_target_dir, variant, folder) + if os.path.exists(src_dir): + # If destination exists, remove it first + if os.path.exists(dst_dir): + shutil.rmtree(dst_dir) + os.makedirs(os.path.dirname(dst_dir), exist_ok=True) + shutil.copytree(src_dir, dst_dir) + else: + print(f"Warning: {src_dir} does not exist and will be skipped.") + + # Step4: Copy multilib.yaml file as it is from the non-optimised multilib directoy. + src_yaml = os.path.join(args.multilib_non_optimised_dir, "multilib.yaml") + dst_yaml = os.path.join(args.multilib_optimised_dir, "multilib.yaml") + if os.path.exists(src_yaml): + shutil.copy2(src_yaml, dst_yaml) + else: + print(f"Warning: {src_yaml} does not exist.") + + +def main(): + parser = argparse.ArgumentParser( + description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter, + ) + parser.add_argument( + "multilib_non_optimised_dir", + help="CMake binary directory containing the non-optimised multilib headers", + ) + parser.add_argument( + "multilib_optimised_dir", + help="CMake binary directory where the optimised multilib headers should be generated", + ) + args = parser.parse_args() + + extract_common_headers_for_targets(args) + + +if __name__ == "__main__": + main() From dee16cfe07d3e5b7c8a5f17789bca0b3d8b064ef Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Tue, 15 Jul 2025 15:40:56 +0100 Subject: [PATCH 2/9] fixup! [ATFE] Make sure multilib-optimised directory created no earlier than the variant comparison step. --- arm-software/embedded/arm-multilib/common-headers-generate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arm-software/embedded/arm-multilib/common-headers-generate.py b/arm-software/embedded/arm-multilib/common-headers-generate.py index fcaef114b47f..d7386e4999ef 100755 --- a/arm-software/embedded/arm-multilib/common-headers-generate.py +++ b/arm-software/embedded/arm-multilib/common-headers-generate.py @@ -67,8 +67,6 @@ def extract_common_headers_for_targets(args): ) continue - os.makedirs(output_include_dir, exist_ok=True) - variant_includes = collect_variant_include_paths(input_target_dir) if len(variant_includes) < 2: print( @@ -76,6 +74,8 @@ def extract_common_headers_for_targets(args): ) return + os.makedirs(output_include_dir, exist_ok=True) + # Step 1: compare first two variants and extract the common headers into the targets common include directory base_dir = list(variant_includes.values())[0] compare_dir = list(variant_includes.values())[1] From bddfb9632862e191f892e0bc5d356f2bb387d6aa Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Thu, 17 Jul 2025 09:08:34 +0100 Subject: [PATCH 3/9] fixup! [ATFE] Ensure dependency on multilib-yaml as script expects the file. The script that performs the common header generation assumes the multilib YAML file is already generated. This change adds an explicit dependency on the multilib-yaml target to ensure the file exists before the common header generate step is triggered. --- arm-software/embedded/arm-multilib/CMakeLists.txt | 7 +++---- .../embedded/arm-multilib/common-headers-generate.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arm-software/embedded/arm-multilib/CMakeLists.txt b/arm-software/embedded/arm-multilib/CMakeLists.txt index 155993312c40..1cf7a169e7cf 100644 --- a/arm-software/embedded/arm-multilib/CMakeLists.txt +++ b/arm-software/embedded/arm-multilib/CMakeLists.txt @@ -362,7 +362,6 @@ foreach(lib_idx RANGE ${lib_count_dec}) endforeach() - # Multilib file is generated in two parts. # 1. Template is filled with multilib flags from json configure_file( @@ -407,11 +406,11 @@ if(ENABLE_MULTILIB_HEADER_OPTIMISATION) "${CMAKE_CURRENT_BINARY_DIR}/multilib" "${CMAKE_CURRENT_BINARY_DIR}/multilib-optimised" COMMENT "Generating common headers" - DEPENDS ${all_runtime_targets} + DEPENDS ${all_runtime_targets} multilib-yaml ) install( - DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/multilib-optimised/" - DESTINATION . + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/multilib-optimised/" + DESTINATION . ) endif() diff --git a/arm-software/embedded/arm-multilib/common-headers-generate.py b/arm-software/embedded/arm-multilib/common-headers-generate.py index d7386e4999ef..eeff5aaca7f7 100755 --- a/arm-software/embedded/arm-multilib/common-headers-generate.py +++ b/arm-software/embedded/arm-multilib/common-headers-generate.py @@ -134,7 +134,7 @@ def extract_common_headers_for_targets(args): if os.path.exists(src_yaml): shutil.copy2(src_yaml, dst_yaml) else: - print(f"Warning: {src_yaml} does not exist.") + raise FileNotFoundError(f"Source yaml '{src_yaml}' does not exist.") def main(): From c2f5ebc84e19785d0310284e0ac1c1a7da63016d Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Wed, 23 Jul 2025 15:38:41 +0100 Subject: [PATCH 4/9] fixup! Add IncludePath to multilib.yaml conditionally. Only enable IncludePaths in multilib.yaml if header optimization is turned on. --- arm-software/embedded/arm-multilib/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arm-software/embedded/arm-multilib/CMakeLists.txt b/arm-software/embedded/arm-multilib/CMakeLists.txt index 1cf7a169e7cf..e9cf4c5078dc 100644 --- a/arm-software/embedded/arm-multilib/CMakeLists.txt +++ b/arm-software/embedded/arm-multilib/CMakeLists.txt @@ -342,10 +342,12 @@ foreach(lib_idx RANGE ${lib_count_dec}) foreach(flag ${multilib_flags_list}) string(APPEND multilib_yaml_content " - ${flag}\n") endforeach() - string(APPEND multilib_yaml_content " IncludePath:\n") - string(APPEND multilib_yaml_content " - ${parent_dir_name}/include\n") - string(APPEND multilib_yaml_content " - ${parent_dir_name}/${variant}/include\n") - string(APPEND multilib_yaml_content " Group: stdlibs\n") + if(ENABLE_MULTILIB_HEADER_OPTIMISATION) + string(APPEND multilib_yaml_content " IncludePath:\n") + string(APPEND multilib_yaml_content " - ${parent_dir_name}/include\n") + string(APPEND multilib_yaml_content " - ${parent_dir_name}/${variant}/include\n") + string(APPEND multilib_yaml_content " Group: stdlibs\n") + endif() else() # In place of a json, an error message is expected. string(JSON variant_error_msg GET ${lib_def} "error") From ffdca78596eb9c0cc75438b93c4a34db8348e61b Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Thu, 24 Jul 2025 18:12:23 +0100 Subject: [PATCH 5/9] fixup! Python script needs to always create the multilib-optimised folder --- arm-software/embedded/arm-multilib/CMakeLists.txt | 10 ++++++---- .../embedded/arm-multilib/common-headers-generate.py | 11 ++++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/arm-software/embedded/arm-multilib/CMakeLists.txt b/arm-software/embedded/arm-multilib/CMakeLists.txt index e9cf4c5078dc..569914217240 100644 --- a/arm-software/embedded/arm-multilib/CMakeLists.txt +++ b/arm-software/embedded/arm-multilib/CMakeLists.txt @@ -396,10 +396,12 @@ add_custom_command( ) add_custom_target(multilib-yaml ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/multilib/multilib.yaml) -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/multilib/multilib.yaml - DESTINATION . -) +if(NOT ENABLE_MULTILIB_HEADER_OPTIMISATION) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/multilib/multilib.yaml + DESTINATION . + ) +endif() # Extract common header files which spans across multilib variant directories. if(ENABLE_MULTILIB_HEADER_OPTIMISATION) diff --git a/arm-software/embedded/arm-multilib/common-headers-generate.py b/arm-software/embedded/arm-multilib/common-headers-generate.py index eeff5aaca7f7..22498fe0eaf7 100755 --- a/arm-software/embedded/arm-multilib/common-headers-generate.py +++ b/arm-software/embedded/arm-multilib/common-headers-generate.py @@ -52,6 +52,9 @@ def collect_variant_include_paths(input_target_dir): def extract_common_headers_for_targets(args): + if os.path.exists(args.multilib_optimised_dir): + shutil.rmtree(args.multilib_optimised_dir) + for target in MULTILIB_TARGET_DIRS: input_target_dir = os.path.join( os.path.abspath(args.multilib_non_optimised_dir), target @@ -70,10 +73,16 @@ def extract_common_headers_for_targets(args): variant_includes = collect_variant_include_paths(input_target_dir) if len(variant_includes) < 2: print( - f"Skipping extracing the common headers for {target}: not enough variants to compare.At least two variants must be enabled for the multilib header optimisation phase to proceed." + f"Skipping extracting the common headers for {target}: not enough variants to compare.At least two variants must be enabled for the multilib header optimisation phase to proceed." ) + # The script always creates the multilib-optimised folder, even when there's only one variant and no + # optimization is applied. In that case, multilib-optimised will just contain a copy of the + # single variant from the non-optimised multilib directory. + if os.path.exists(args.multilib_non_optimised_dir): + shutil.copytree(args.multilib_non_optimised_dir, args.multilib_optimised_dir) return + # Creating the common include headers for each target os.makedirs(output_include_dir, exist_ok=True) # Step 1: compare first two variants and extract the common headers into the targets common include directory From edbe90ce334140ecc46ca1123d84faea70ac7bc3 Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Fri, 25 Jul 2025 11:40:42 +0100 Subject: [PATCH 6/9] fixup! Make ENABLE_MULTILIB_HEADER_OPTIMISATION is OFF by default. At present ENABLE_MULTILIB_HEADER_OPTIMISATION has to be disabled as this feature is not fully supported from the toolchain yet. --- arm-software/embedded/CMakeLists.txt | 5 ++++- arm-software/embedded/arm-multilib/CMakeLists.txt | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arm-software/embedded/CMakeLists.txt b/arm-software/embedded/CMakeLists.txt index 25680c3a39fa..061f8bdf8a3e 100644 --- a/arm-software/embedded/CMakeLists.txt +++ b/arm-software/embedded/CMakeLists.txt @@ -182,8 +182,11 @@ option( option( ENABLE_MULTILIB_HEADER_OPTIMISATION "Enable multilib header optimisation phase" - ON + OFF ) +if(ENABLE_MULTILIB_HEADER_OPTIMISATION) + message(WARNING "ENABLE_MULTILIB_HEADER_OPTIMISATION is not recommended to be enabled. This feature is not fully supported from the toolchain.") +endif() # Previously, the LLVM_TOOLCHAIN_LIBRARY_OVERLAY_INSTALL option was # called LLVM_TOOLCHAIN_NEWLIB_OVERLAY_INSTALL. Detect a setting of diff --git a/arm-software/embedded/arm-multilib/CMakeLists.txt b/arm-software/embedded/arm-multilib/CMakeLists.txt index 569914217240..6586a460d5ab 100644 --- a/arm-software/embedded/arm-multilib/CMakeLists.txt +++ b/arm-software/embedded/arm-multilib/CMakeLists.txt @@ -48,7 +48,7 @@ set( fvp/get_fvps.sh" ) set(FVP_CONFIG_DIR "${TOOLCHAIN_SOURCE_DIR}/fvp/config" CACHE STRING "The directory in which the FVP models are installed.") -option(ENABLE_MULTILIB_HEADER_OPTIMISATION "Enable multilib header optimisation phase" ON) +option(ENABLE_MULTILIB_HEADER_OPTIMISATION "Enable multilib header optimisation phase" OFF) option( ENABLE_PARALLEL_LIB_CONFIG "Run the library variant configuration steps in parallel." From 2f51b287456d5d8124ab9cafcb34bd3f37990a45 Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Mon, 28 Jul 2025 11:57:18 +0100 Subject: [PATCH 7/9] fixup! Make ENABLE_MULTILIB_HEADER_OPTIMISATION is ON by default --- arm-software/embedded/CMakeLists.txt | 5 +---- arm-software/embedded/arm-multilib/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/arm-software/embedded/CMakeLists.txt b/arm-software/embedded/CMakeLists.txt index 061f8bdf8a3e..25680c3a39fa 100644 --- a/arm-software/embedded/CMakeLists.txt +++ b/arm-software/embedded/CMakeLists.txt @@ -182,11 +182,8 @@ option( option( ENABLE_MULTILIB_HEADER_OPTIMISATION "Enable multilib header optimisation phase" - OFF + ON ) -if(ENABLE_MULTILIB_HEADER_OPTIMISATION) - message(WARNING "ENABLE_MULTILIB_HEADER_OPTIMISATION is not recommended to be enabled. This feature is not fully supported from the toolchain.") -endif() # Previously, the LLVM_TOOLCHAIN_LIBRARY_OVERLAY_INSTALL option was # called LLVM_TOOLCHAIN_NEWLIB_OVERLAY_INSTALL. Detect a setting of diff --git a/arm-software/embedded/arm-multilib/CMakeLists.txt b/arm-software/embedded/arm-multilib/CMakeLists.txt index 6586a460d5ab..569914217240 100644 --- a/arm-software/embedded/arm-multilib/CMakeLists.txt +++ b/arm-software/embedded/arm-multilib/CMakeLists.txt @@ -48,7 +48,7 @@ set( fvp/get_fvps.sh" ) set(FVP_CONFIG_DIR "${TOOLCHAIN_SOURCE_DIR}/fvp/config" CACHE STRING "The directory in which the FVP models are installed.") -option(ENABLE_MULTILIB_HEADER_OPTIMISATION "Enable multilib header optimisation phase" OFF) +option(ENABLE_MULTILIB_HEADER_OPTIMISATION "Enable multilib header optimisation phase" ON) option( ENABLE_PARALLEL_LIB_CONFIG "Run the library variant configuration steps in parallel." From a57c95b8380d0f0c99d78d09a66c4dbaebc7c708 Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Mon, 28 Jul 2025 13:59:33 +0100 Subject: [PATCH 8/9] fixup! Using IncludeDirs instead of IncludePath. --- arm-software/embedded/arm-multilib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm-software/embedded/arm-multilib/CMakeLists.txt b/arm-software/embedded/arm-multilib/CMakeLists.txt index 569914217240..2b4e0641ff81 100644 --- a/arm-software/embedded/arm-multilib/CMakeLists.txt +++ b/arm-software/embedded/arm-multilib/CMakeLists.txt @@ -343,7 +343,7 @@ foreach(lib_idx RANGE ${lib_count_dec}) string(APPEND multilib_yaml_content " - ${flag}\n") endforeach() if(ENABLE_MULTILIB_HEADER_OPTIMISATION) - string(APPEND multilib_yaml_content " IncludePath:\n") + string(APPEND multilib_yaml_content " IncludeDirs:\n") string(APPEND multilib_yaml_content " - ${parent_dir_name}/include\n") string(APPEND multilib_yaml_content " - ${parent_dir_name}/${variant}/include\n") string(APPEND multilib_yaml_content " Group: stdlibs\n") From 544443422eb70c8ba0cc4206879034d7ed477d38 Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Mon, 28 Jul 2025 14:48:30 +0100 Subject: [PATCH 9/9] fixup! stdlibs has to be added irrespecitve of the header optiimisation enablement. --- arm-software/embedded/arm-multilib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm-software/embedded/arm-multilib/CMakeLists.txt b/arm-software/embedded/arm-multilib/CMakeLists.txt index 2b4e0641ff81..ce001d71eb59 100644 --- a/arm-software/embedded/arm-multilib/CMakeLists.txt +++ b/arm-software/embedded/arm-multilib/CMakeLists.txt @@ -346,8 +346,8 @@ foreach(lib_idx RANGE ${lib_count_dec}) string(APPEND multilib_yaml_content " IncludeDirs:\n") string(APPEND multilib_yaml_content " - ${parent_dir_name}/include\n") string(APPEND multilib_yaml_content " - ${parent_dir_name}/${variant}/include\n") - string(APPEND multilib_yaml_content " Group: stdlibs\n") endif() + string(APPEND multilib_yaml_content " Group: stdlibs\n") else() # In place of a json, an error message is expected. string(JSON variant_error_msg GET ${lib_def} "error")