Skip to content

[ATfL][build.sh] Help CMake to pass the COMPILER_RT_TARGET_HAS_ATOMICS test - #1047

Open
pawosm-arm wants to merge 1 commit into
arm-softwarefrom
users/pawosm-arm/atfl-help-with-atomics
Open

pawosm-arm wants to merge 1 commit into
arm-softwarefrom
users/pawosm-arm/atfl-help-with-atomics

Conversation

@pawosm-arm

@pawosm-arm pawosm-arm commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

The product_build/runtimes/runtimes-bins/CMakeCache.txt file generated
by CMake insists that there are no atomics in the compiler-rt library:
//Test COMPILER_RT_TARGET_HAS_ATOMICS
COMPILER_RT_TARGET_HAS_ATOMICS:INTERNAL=

This is due to a failing test which does not actually link the compiler-rt
library, which results in a linker error and failed CMake test:

    ld.lld: error: undefined symbol: __aarch64_cas8_acq_rel
    >>> referenced by src.cxx
    >>>               CMakeFiles/cmTC_7f91d.dir/src.cxx.o:(main)
    ld.lld: error: undefined symbol: __aarch64_ldadd8_acq_rel
    >>> referenced by src.cxx
    >>>               CMakeFiles/cmTC_7f91d.dir/src.cxx.o:(main)
    >>> referenced by src.cxx
    >>>               CMakeFiles/cmTC_7f91d.dir/src.cxx.o:(main)
    clang++: error: linker command failed with exit code 1

See product_build/runtimes/runtimes-bins/CMakeFiles/CMakeConfigureLog.yaml
for a complete log.

This causes a cascade of subtle problems down the line, including
faulty PGO instrumentation code being injected into instrumented
binaries, which causes race condidtions whenever the instrumented
code is multi-threaded.

This patch helps linking the compiler-rt library when building the
runtimes.

Note that for this patch to have any effect, a companion upstream PR
needs to be merged which fixes a bug in the
compiler-rt/cmake/config-ix.cmake file: llvm/llvm-project#224681

@pawosm-arm

Copy link
Copy Markdown
Contributor Author

Rebased and adjusted to the most recent changes.

@pawosm-arm

Copy link
Copy Markdown
Contributor Author

I need to rework this patch. I should have spotted this sooner in the CMake files...:

# TODO(PR51389): We should check COMPILER_RT_BUILTINS_LIBRARY and report an
# error if the value is NOTFOUND rather than silently continuing...

This suggests which unexposed problem should be addressed first.

…S test

The product_build/runtimes/runtimes-bins/CMakeCache.txt file generated
by CMake insists that there are no atomics in the compiler-rt library:
//Test COMPILER_RT_TARGET_HAS_ATOMICS
COMPILER_RT_TARGET_HAS_ATOMICS:INTERNAL=

This is due to a failing test which does not actually link the compiler-rt
library, which results in a linker error and failed CMake test:

        ld.lld: error: undefined symbol: __aarch64_cas8_acq_rel
        >>> referenced by src.cxx
        >>>               CMakeFiles/cmTC_7f91d.dir/src.cxx.o:(main)
        ld.lld: error: undefined symbol: __aarch64_ldadd8_acq_rel
        >>> referenced by src.cxx
        >>>               CMakeFiles/cmTC_7f91d.dir/src.cxx.o:(main)
        >>> referenced by src.cxx
        >>>               CMakeFiles/cmTC_7f91d.dir/src.cxx.o:(main)
        clang++: error: linker command failed with exit code 1

See product_build/runtimes/runtimes-bins/CMakeFiles/CMakeConfigureLog.yaml
for a complete log.

This causes a cascade of subtle problems down the line, including
faulty PGO instrumentation code being injected into instrumented
binaries, which causes race condidtions whenever the instrumented
code is multi-threaded.

This patch helps linking the compiler-rt library when building the
runtimes.

Note that for this patch to have any effect, a companion upstream PR
needs to be merged which fixes a bug in the
compiler-rt/cmake/config-ix.cmake file.
@pawosm-arm
pawosm-arm force-pushed the users/pawosm-arm/atfl-help-with-atomics branch from d783624 to a60ccac Compare September 17, 2026 22:49
@pawosm-arm

Copy link
Copy Markdown
Contributor Author

I need to rework this patch. I should have spotted this sooner in the CMake files...:

# TODO(PR51389): We should check COMPILER_RT_BUILTINS_LIBRARY and report an
# error if the value is NOTFOUND rather than silently continuing...

This suggests which unexposed problem should be addressed first.

That's not all, and that's not even a stopper. The real bug also needs to be fixed and I've positively tested a fix. I'll open an upstream PR soon(-ish).

@pawosm-arm

Copy link
Copy Markdown
Contributor Author

The upstream part has been merged: llvm/llvm-project#224681

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.

1 participant