2018-05-02 00:09:31 -05:00
|
|
|
# Configuration for host installed llvm
|
|
|
|
#
|
|
|
|
|
|
|
|
set(NOSTDINC "")
|
|
|
|
|
2018-11-01 09:45:54 -07:00
|
|
|
# Note that NOSYSDEF_CFLAG may be an empty string, and
|
|
|
|
# set_ifndef() does not work with empty string.
|
|
|
|
if(NOT DEFINED NOSYSDEF_CFLAG)
|
|
|
|
set(NOSYSDEF_CFLAG -undef)
|
|
|
|
endif()
|
|
|
|
|
2018-12-13 16:32:07 +01:00
|
|
|
find_program(CMAKE_C_COMPILER clang PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
|
|
|
find_program(CMAKE_CXX_COMPILER clang++ PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
|
|
|
find_program(CMAKE_AR llvm-ar PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
|
|
|
find_program(CMAKE_LINKER llvm-link PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
|
|
|
find_program(CMAKE_NM llvm-nm PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
|
|
|
find_program(CMAKE_OBJDUMP llvm-objdump PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
|
|
|
find_program(CMAKE_RANLIB llvm-ranlib PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
|
|
|
|
find_program(CMAKE_OBJCOPY objcopy PATH ${TOOLCHAIN_HOME})
|
|
|
|
find_program(CMAKE_READELF readelf PATH ${TOOLCHAIN_HOME})
|
2018-12-10 15:08:59 +01:00
|
|
|
|
2018-05-02 00:09:31 -05:00
|
|
|
foreach(file_name include include-fixed)
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_C_COMPILER} --print-file-name=${file_name}
|
|
|
|
OUTPUT_VARIABLE _OUTPUT
|
|
|
|
)
|
|
|
|
string(REGEX REPLACE "\n" "" _OUTPUT ${_OUTPUT})
|
|
|
|
|
|
|
|
list(APPEND NOSTDINC ${_OUTPUT})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
foreach(isystem_include_dir ${NOSTDINC})
|
|
|
|
list(APPEND isystem_include_flags -isystem ${isystem_include_dir})
|
|
|
|
endforeach()
|
|
|
|
|
host-gcc: TOOLCHAIN_LIBS += libgcc (copied from compiler/gcc/)
Add missing -lgcc when compiling with ZEPHYR_TOOLCHAIN_VARIANT=host
merely copying some existing code from
'compiler/{clang,gcc}/target.cmake'.
This fixes compilation for the following boards with an x86
microprocessor:
galileo, minnowboard, qemu_x86, qemu_x86_nommu, up_squared,
up_squared_sbl
Compilation of the following boards with an X86_IAMCU microcontroller
still fail with a "cannot find -lgcc" error:
arduino_101, qemu_x86_iamcu, quark_d2000_crb, quark_se_c1000_devboard,
tinytile
This is _not_ a regression because these boards _already_ failed with
"undefined reference to __udivdi3" and other libgcc symbols.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-01-22 17:54:42 -08:00
|
|
|
# This libgcc code is partially duplicated in compiler/*/target.cmake
|
2018-12-10 15:18:20 +01:00
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_C_COMPILER} ${TOOLCHAIN_C_FLAGS} --print-libgcc-file-name
|
|
|
|
OUTPUT_VARIABLE LIBGCC_FILE_NAME
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
|
|
|
|
assert_exists(LIBGCC_FILE_NAME)
|
|
|
|
|
|
|
|
get_filename_component(LIBGCC_DIR ${LIBGCC_FILE_NAME} DIRECTORY)
|
|
|
|
|
|
|
|
assert_exists(LIBGCC_DIR)
|
|
|
|
|
|
|
|
list(APPEND LIB_INCLUDE_DIR "-L\"${LIBGCC_DIR}\"")
|
|
|
|
list(APPEND TOOLCHAIN_LIBS gcc)
|
|
|
|
|
2018-05-02 00:09:31 -05:00
|
|
|
set(CMAKE_REQUIRED_FLAGS -nostartfiles -nostdlib ${isystem_include_flags} -Wl,--unresolved-symbols=ignore-in-object-files)
|
|
|
|
string(REPLACE ";" " " CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
2019-01-10 12:07:51 +01:00
|
|
|
|
|
|
|
# Load toolchain_cc-family macros
|
|
|
|
# Clang and GCC are almost feature+flag compatible, so reuse freestanding gcc
|
|
|
|
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_security_fortify.cmake)
|
|
|
|
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_security_canaries.cmake)
|
2019-01-30 10:12:30 +01:00
|
|
|
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_optimizations.cmake)
|
2019-02-18 23:54:30 +01:00
|
|
|
include(${ZEPHYR_BASE}/cmake/compiler/gcc/target_cpp.cmake)
|