Skip to content

Commit 1567f72

Browse files
author
git apple-llvm automerger
committed
Merge commit '430c4952286f' from llvm.org/release/19.x into stable/20240723
2 parents 8db9fe5 + 430c495 commit 1567f72

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

compiler-rt/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ include(CompilerRTUtils)
3939
include(CMakeDependentOption)
4040
include(GetDarwinLinkerVersion)
4141

42+
include(CheckCXXCompilerFlag)
43+
44+
# Check if we can compile with --no-default-config, or if that omits a config
45+
# file that is essential for the toolchain to work properly.
46+
#
47+
# Using CMAKE_REQUIRED_FLAGS to make sure the flag is used both for compilation
48+
# and for linking.
49+
#
50+
# Doing this test early on, to see if the flag works on the toolchain
51+
# out of the box. Later on, we end up adding -nostdlib and similar flags
52+
# to all test compiles, which easily can give false positives on this test.
53+
set(OLD_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
54+
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --no-default-config")
55+
check_cxx_compiler_flag("" COMPILER_RT_HAS_NO_DEFAULT_CONFIG_FLAG)
56+
set(CMAKE_REQUIRED_FLAGS "${OLD_CMAKE_REQUIRED_FLAGS}")
57+
4258
option(COMPILER_RT_BUILD_BUILTINS "Build builtins" ON)
4359
mark_as_advanced(COMPILER_RT_BUILD_BUILTINS)
4460
option(COMPILER_RT_DISABLE_AARCH64_FMV "Disable AArch64 Function Multi Versioning support" OFF)

compiler-rt/test/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ pythonize_bool(COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER)
1212

1313
pythonize_bool(COMPILER_RT_HAS_AARCH64_SME)
1414

15+
pythonize_bool(COMPILER_RT_HAS_NO_DEFAULT_CONFIG_FLAG)
16+
1517
configure_compiler_rt_lit_site_cfg(
1618
${CMAKE_CURRENT_SOURCE_DIR}/lit.common.configured.in
1719
${CMAKE_CURRENT_BINARY_DIR}/lit.common.configured)

compiler-rt/test/lit.common.cfg.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,11 @@ def is_windows_lto_supported():
983983
# default configs for the test runs. In particular, anything hardening
984984
# related is likely to cause issues with sanitizer tests, because it may
985985
# preempt something we're looking to trap (e.g. _FORTIFY_SOURCE vs our ASAN).
986-
config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"
986+
#
987+
# Only set this if we know we can still build for the target while disabling
988+
# default configs.
989+
if config.has_no_default_config_flag:
990+
config.environment["CLANG_NO_DEFAULT_CONFIG"] = "1"
987991

988992
if config.has_compiler_rt_libatomic:
989993
base_lib = os.path.join(config.compiler_rt_libdir, "libclang_rt.atomic%s.so"

compiler-rt/test/lit.common.configured.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ set_default("test_standalone_build_libs", @COMPILER_RT_TEST_STANDALONE_BUILD_LIB
5353
set_default("has_compiler_rt_libatomic", @COMPILER_RT_BUILD_STANDALONE_LIBATOMIC_PYBOOL@)
5454
set_default("aarch64_sme", @COMPILER_RT_HAS_AARCH64_SME_PYBOOL@)
5555
set_default("darwin_linker_version", "@COMPILER_RT_DARWIN_LINKER_VERSION@")
56+
set_default("has_no_default_config_flag", @COMPILER_RT_HAS_NO_DEFAULT_CONFIG_FLAG_PYBOOL@)
5657
# True iff the test suite supports ignoring the test compiler's runtime library path
5758
# and using `config.compiler_rt_libdir` instead. This only matters when the runtime
5859
# library paths differ.

0 commit comments

Comments
 (0)