Skip to content

compiler-rt: Exclude sync_fetch_and_* for any pre-ARMv6 targets #139411

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions compiler-rt/lib/builtins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,18 @@ else ()
${TARGET_${arch}_CFLAGS})
list(JOIN CMAKE_REQUIRED_FLAGS " " CMAKE_REQUIRED_FLAGS)
message(STATUS "Performing additional configure checks with target flags: ${CMAKE_REQUIRED_FLAGS}")
# For ARM archs, exclude any sync builtins if dmb or mcr p15, #0, r0, c7, c10, #5
Copy link
Member

Choose a reason for hiding this comment

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

I would rephrase the comment and the error message to be more clear about the overall intent. From the comment and the error message I would think that we're testing for the DMB instruction specifically. Perhaps that was the case in an earlier iteration of the patch?

For the comment I'd write something like:
Exclude sync builtins for Arm architectures before Armv6

And for the error I'd write something like:
#error sync builtins are not supported prior to Armv6

# is not supported
if (${arch} MATCHES "^(arm|armhf)$")
try_compile_only(COMPILER_RT_HAS_${arch}_SYNC
SOURCE "#if __ARM_ARCH < 6
#error DMB is only supported on ARMv6+ !
#endif
int main(void) { return 0; }")
if(NOT COMPILER_RT_HAS_${arch}_SYNC)
list(REMOVE_ITEM ${arch}_SOURCES ${arm_sync_SOURCES})
endif()
endif()
# For ARM archs, exclude any VFP builtins if VFP is not supported
if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em|armv8m.main|armv8.1m.main)$")
check_compile_definition(__ARM_FP "${CMAKE_C_FLAGS}" COMPILER_RT_HAS_${arch}_VFP)
Expand Down
Loading