@@ -50,15 +50,18 @@ set(AVAILABLE_COMPILER_FEATURES "")
50
50
foreach (feature IN LISTS ALL_COMPILER_FEATURES )
51
51
set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY )
52
52
set (compile_options ${LIBC_COMPILE_OPTIONS_NATIVE} )
53
+ set (link_options "" )
53
54
if (${feature} STREQUAL "fixed_point" )
54
55
list (APPEND compile_options "-ffixed-point" )
55
56
elseif (${feature} MATCHES "^builtin_" )
56
57
set (compile_options ${LIBC_COMPILE_OPTIONS_DEFAULT} )
58
+ set (link_options -nostdlib )
57
59
# The compiler might handle calls to rounding builtins by generating calls
58
60
# to the respective libc math functions, in which case we cannot use these
59
61
# builtins in our implementations of these functions. We check that this is
60
62
# not the case by trying to link an executable, since linking would fail due
61
- # to unresolved references if calls to libc functions were generated.
63
+ # to unresolved references with -nostdlib if calls to libc functions were
64
+ # generated.
62
65
set (CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE )
63
66
endif ()
64
67
@@ -67,6 +70,7 @@ foreach(feature IN LISTS ALL_COMPILER_FEATURES)
67
70
${CMAKE_CURRENT_BINARY_DIR} /compiler_features
68
71
SOURCES ${LIBC_SOURCE_DIR} /cmake/modules/compiler_features/check_${feature}.cpp
69
72
COMPILE_DEFINITIONS -I${LIBC_SOURCE_DIR} ${compile_options}
73
+ LINK_OPTIONS ${link_options}
70
74
)
71
75
if (has_feature )
72
76
list (APPEND AVAILABLE_COMPILER_FEATURES ${feature} )
0 commit comments