posix: cmake: Abstract freestanding options
clang has problems compiling the native_posix with -fno-freestanding. Signed-off-by: Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com>
This commit is contained in:
parent
ab2f00e9f1
commit
f616aa3736
5 changed files with 18 additions and 1 deletions
|
@ -1,7 +1,6 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
zephyr_compile_options(
|
||||
-fno-freestanding
|
||||
-m32
|
||||
-MMD
|
||||
-MP
|
||||
|
@ -9,6 +8,9 @@ zephyr_compile_options(
|
|||
-include ${ZEPHYR_BASE}/arch/posix/include/posix_cheats.h
|
||||
)
|
||||
|
||||
# @Intent: Obtain compiler specific flags for no freestanding compilation
|
||||
toolchain_cc_no_freestanding_options()
|
||||
|
||||
zephyr_include_directories(${BOARD_DIR})
|
||||
|
||||
zephyr_compile_options_ifdef(CONFIG_COVERAGE
|
||||
|
|
|
@ -79,3 +79,8 @@ include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_baremetal.cmake)
|
|||
macro(toolchain_cc_security_fortify)
|
||||
# No op, clang doesn't understand fortify at all
|
||||
endmacro()
|
||||
|
||||
macro(toolchain_cc_no_freestanding_options)
|
||||
# No op, this is used by the native_posix, clang has problems
|
||||
# compiling the native_posix with -fno-freestanding.
|
||||
endmacro()
|
||||
|
|
|
@ -131,6 +131,7 @@ list(APPEND CMAKE_REQUIRED_FLAGS -nostartfiles -nostdlib ${isystem_include_flags
|
|||
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||
|
||||
# Load toolchain_cc-family macros
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_freestanding.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_security_fortify.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_security_canaries.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_optimizations.cmake)
|
||||
|
|
8
cmake/compiler/gcc/target_freestanding.cmake
Normal file
8
cmake/compiler/gcc/target_freestanding.cmake
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Copyright (c) 2019 Intel Corporation.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
macro(toolchain_cc_no_freestanding_options)
|
||||
|
||||
zephyr_cc_option(-fno-freestanding)
|
||||
|
||||
endmacro()
|
|
@ -81,6 +81,7 @@ endforeach()
|
|||
|
||||
# Load toolchain_cc-family macros
|
||||
# Significant overlap with freestanding gcc compiler so reuse it
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_freestanding.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_security_fortify.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_security_canaries.cmake)
|
||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_optimizations.cmake)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue