Skip to content

Commit

Permalink
x86_64: use host toolchain
Browse files Browse the repository at this point in the history
We were select host compiler from the generic gcc compiler section which
is used for cross toolchains. This arch should use the host-gcc compiler
definition instead.

Signed-off-by: Anas Nashif <[email protected]>
  • Loading branch information
nashif authored and galak committed Feb 10, 2019
1 parent 839db87 commit 33ca224
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
25 changes: 0 additions & 25 deletions cmake/compiler/gcc/target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,6 @@ find_program(CMAKE_READELF ${CROSS_COMPILE}readelf PATH ${TOOLCHAIN_HOME} NO_
find_program(CMAKE_GDB ${CROSS_COMPILE}gdb PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
find_program(CMAKE_NM ${CROSS_COMPILE}nm PATH ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)

# x86_64 should pick up a proper cross compiler if one is provided,
# but falling back to using the host toolchain is a very sane behavior
# too.
# As an alternative to this fall back try ZEPHYR_TOOLCHAIN_VARIANT=host
# directly.
if(CONFIG_X86_64)
if(CMAKE_C_COMPILER STREQUAL CMAKE_C_COMPILER-NOTFOUND)
find_program(CMAKE_C_COMPILER gcc )
find_program(CMAKE_OBJCOPY objcopy)
find_program(CMAKE_OBJDUMP objdump)
find_program(CMAKE_AR ar )
find_program(CMAKE_RANLILB ranlib )
find_program(CMAKE_READELF readelf)
find_program(CMAKE_GDB gdb )
endif()

# When building in x32 mode with a host compiler, there is no libgcc
# shipped (because it's an x86_64 compiler, not x32). That's
# actually non-fatal, as no known features we hit in existing code
# actually require the library. But I can't find an exaustive list
# of exactly what can break, so this is fragile. Long term we
# really need to be blessing a proper cross toolchain.
set(no_libgcc Y)
endif()

if(CONFIG_CPLUSPLUS)
set(cplusplus_compiler ${CROSS_COMPILE}${C++})
else()
Expand Down
2 changes: 1 addition & 1 deletion cmake/generic_toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ set(ZEPHYR_TOOLCHAIN_VARIANT ${ZEPHYR_TOOLCHAIN_VARIANT} CACHE STRING "Zephyr to
assert(ZEPHYR_TOOLCHAIN_VARIANT "Zephyr toolchain variant invalid: please set the ZEPHYR_TOOLCHAIN_VARIANT-variable")

# Pick host system's toolchain if we are targeting posix
if(${ARCH} STREQUAL "posix")
if((${ARCH} STREQUAL "posix") OR (${ARCH} STREQUAL "x86_64"))
set(ZEPHYR_TOOLCHAIN_VARIANT "host")
endif()

Expand Down

0 comments on commit 33ca224

Please sign in to comment.