Skip to content

Commit 1e33936

Browse files
committed
compiler-rt: Fix cmake check for _Float16 and __bf16
When using check_c_source_compiles cmake function, main has to be provided, otherwise while compile step will be fine but linking step will fail as there will be no main function and test will fail and disable building HF builtins into compiler-rt Fixes configure errors like below aarch64-yoe-linux-ld.lld: error: undefined symbol: main referenced by start.S:81 (../sysdeps/aarch64/start.S:81) /mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/compiler-rt/18.1.0/recipe-sysroot/usr/lib/Scrt1.o:(_start) referenced by start.S:82 (../sysdeps/aarch64/start.S:82) /mnt/b/yoe/master/build/tmp/work/cortexa72-cortexa53-crypto-yoe-linux/compiler-rt/18.1.0/recipe-sysroot/usr/lib/Scrt1.o:(_start) aarch64-yoe-linux-clang: error: linker command failed with exit code 1 (use -v to see invocation)
1 parent 463fb9f commit 1e33936

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler-rt/lib/builtins/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,10 +828,10 @@ else ()
828828
endif()
829829
endif()
830830
endif()
831-
check_c_source_compiles("_Float16 foo(_Float16 x) { return x; }"
831+
check_c_source_compiles("_Float16 foo(_Float16 x) { return x; } int main(void) { return foo(1.0); }"
832832
COMPILER_RT_HAS_${arch}_FLOAT16)
833833
append_list_if(COMPILER_RT_HAS_${arch}_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS_${arch})
834-
check_c_source_compiles("__bf16 foo(__bf16 x) { return x; }"
834+
check_c_source_compiles("__bf16 foo(__bf16 x) { return x; } int main(void) { return foo(1.0); }"
835835
COMPILER_RT_HAS_${arch}_BFLOAT16)
836836
# Build BF16 files only when "__bf16" is available.
837837
if(COMPILER_RT_HAS_${arch}_BFLOAT16)

0 commit comments

Comments
 (0)