toolchain: abstract setting -nostdinc
- newlib needs c standard includes (so no -nostdinc) - xcc needs toolchain headers (so no -nostdinc) - with host gcc: - x86_64 should not build with standard includes (-nostdinc needed) - native_posix should build with standard include (no -nostdinc) .. .. To simplify, abstract this and move it to compilers/toolchains and still depend on what the application wants. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
59841c9c67
commit
aa049e5d8f
|
@ -187,9 +187,8 @@ if(NOT CONFIG_RTTI)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CONFIG_NATIVE_APPLICATION)
|
# @Intent: Obtain compiler specific flags for standard C includes
|
||||||
set(NOSTDINC_F -nostdinc)
|
toolchain_cc_nostdinc()
|
||||||
endif()
|
|
||||||
|
|
||||||
zephyr_compile_options(
|
zephyr_compile_options(
|
||||||
-g # TODO: build configuration enough?
|
-g # TODO: build configuration enough?
|
||||||
|
@ -201,7 +200,6 @@ zephyr_compile_options(
|
||||||
-ffreestanding
|
-ffreestanding
|
||||||
-Wno-main
|
-Wno-main
|
||||||
-fno-common
|
-fno-common
|
||||||
${NOSTDINC_F}
|
|
||||||
${TOOLCHAIN_C_FLAGS}
|
${TOOLCHAIN_C_FLAGS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -478,7 +476,6 @@ function(construct_add_custom_command_for_linker_pass linker_output_name output_
|
||||||
${linker_script_dep}
|
${linker_script_dep}
|
||||||
COMMAND ${CMAKE_C_COMPILER}
|
COMMAND ${CMAKE_C_COMPILER}
|
||||||
-x assembler-with-cpp
|
-x assembler-with-cpp
|
||||||
${NOSTDINC_F}
|
|
||||||
${NOSYSDEF_CFLAG}
|
${NOSYSDEF_CFLAG}
|
||||||
-MD -MF ${linker_cmd_file_name}.dep -MT ${base_name}/${linker_cmd_file_name}
|
-MD -MF ${linker_cmd_file_name}.dep -MT ${base_name}/${linker_cmd_file_name}
|
||||||
${current_includes}
|
${current_includes}
|
||||||
|
|
|
@ -135,3 +135,4 @@ include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_security_canaries.cmake
|
||||||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_optimizations.cmake)
|
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_optimizations.cmake)
|
||||||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_cpp.cmake)
|
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_cpp.cmake)
|
||||||
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_asm.cmake)
|
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_asm.cmake)
|
||||||
|
include(${ZEPHYR_BASE}/cmake/compiler/${COMPILER}/target_baremetal.cmake)
|
||||||
|
|
10
cmake/compiler/gcc/target_baremetal.cmake
Normal file
10
cmake/compiler/gcc/target_baremetal.cmake
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
|
||||||
|
macro(toolchain_cc_nostdinc)
|
||||||
|
|
||||||
|
if (NOT CONFIG_NEWLIB_LIBC AND
|
||||||
|
NOT COMPILER STREQUAL "xcc" AND
|
||||||
|
NOT CONFIG_NATIVE_APPLICATION)
|
||||||
|
zephyr_compile_options( -nostdinc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endmacro()
|
|
@ -82,3 +82,4 @@ include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_security_canaries.cmake)
|
||||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_optimizations.cmake)
|
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_optimizations.cmake)
|
||||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_cpp.cmake)
|
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_cpp.cmake)
|
||||||
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_asm.cmake)
|
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_asm.cmake)
|
||||||
|
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_baremetal.cmake)
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
|
|
||||||
macro(toolchain_cc_nostdinc)
|
|
||||||
|
|
||||||
zephyr_compile_options_ifndef(CONFIG_NATIVE_APPLICATION
|
|
||||||
-nostdinc
|
|
||||||
)
|
|
||||||
|
|
||||||
endmacro()
|
|
Loading…
Reference in a new issue