ANDROID: kleaf: fix kselftests build for arm 32bit

When the kselftests are built for 32b ARM, we use the compiler flag
'--target=arm-linux-androideabi31' but do not specify the default CPU
target.  This causes calls to '__sync_bool_compare_and_swap' in the
kselftest harness to be expanded to a libcall to
'__sync_val_compare_and_swap_1'.

This function is explicitly deprecated by GCC's own docs, and LLVM's
compiler-rt does not provide it, resulting in a linkage failure when
building the selftests for arm32.

Explicitly specify a target CPU so that LLVM can expand this intrinsic
call inline properly.  The kernel should look to use (the admittedly
less ergonomic) '__atomic_compare_exchange' instead.

Bug: 342476493
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Suggested-by: Yifan Hong <elsk@google.com>
Change-Id: Ife1137ed4a19c48403e1a8c6a8af39d7e19f53b0
Signed-off-by: Carlos Llamas <cmllamas@google.com>
This commit is contained in:
Carlos Llamas
2024-05-23 22:41:10 +00:00
committed by Treehugger Robot
parent d10af85900
commit eca5347d2b
+4
View File
@@ -1099,6 +1099,10 @@ cc_binary_with_abi(
cc_binary_with_abi(
name = "kselftest_rtc_rtctest",
srcs = ["tools/testing/selftests/rtc/rtctest.c"],
copts = select({
":arm": ["-mcpu=cortex-a8"],
"//conditions:default": [],
}),
path_prefix = _KSELFTEST_DIR,
target_compatible_with = ["@platforms//os:android"],
visibility = ["//visibility:private"],