| commit b1b791a55aee901366e9d096dae167a708c4254d |
| Author: Romaric Jodin <rjodin@chromium.org> |
| Date: Mon Apr 25 10:19:15 2022 +0200 |
| |
| Revert "loader: Check for processor of compiler, not processor of build system" |
| |
| This reverts commit db5e3d0f454f063db7b4505e4d08b759f1874bbb. |
| |
| ``` |
| loader: Check for processor of compiler, not processor of build system |
| If we are cross-compiling, for example for aarch64 on x86, then the |
| compiler we care about here is the machine we are compiling *for*, |
| e.g. aarch64 (the "target" in CMake terminology, the "host system" in |
| Autotools/Meson) rather than the machine we are compiling *on*, e.g. x86 |
| (the "host" in CMake terminology, the "build system" in Autotools/Meson). |
| |
| Signed-off-by: Simon McVittie <smcv@collabora.com> |
| ``` |
| |
| This commit made compiling for trogdor64 fail. Reverting it allow to keep to |
| same behavior as before vulkan-loader update. But the compilation produces a |
| warning message for a potential issue (already pthere before): |
| |
| ``` |
| Could not find working x86_64 GAS assembler |
| |
| The build will fall back on building with C code |
| |
| Note that this may be unsafe, as the C code requires tail-call |
| optimizations to remove the stack frame for certain calls. If the compiler |
| does not do this, then unknown device extensions will suffer from a |
| corrupted stack. |
| ``` |
| |
| This is a know issue track in: |
| https://github.com/KhronosGroup/Vulkan-Loader/issues/249 |
| |
| diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt |
| index a2baca20b..4255cb953 100644 |
| --- a/loader/CMakeLists.txt |
| +++ b/loader/CMakeLists.txt |
| @@ -181,12 +181,12 @@ else() # i.e.: Linux |
| set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS}") |
| set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) |
| |
| - if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") |
| + if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "aarch64") |
| try_compile(ASSEMBLER_WORKS ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/asm_test_aarch64.S) |
| if(ASSEMBLER_WORKS) |
| set(OPT_LOADER_SRCS ${OPT_LOADER_SRCS} unknown_ext_chain_gas_aarch64.S) |
| endif() |
| - elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^i.86$") |
| + elseif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "^i.86$") |
| check_include_file("cet.h" HAVE_CET_H) |
| if(HAVE_CET_H) |
| target_compile_definitions(loader_specific_options INTERFACE HAVE_CET_H) |
| @@ -206,7 +206,7 @@ else() # i.e.: Linux |
| add_custom_target(loader_asm_gen_files DEPENDS gen_defines.asm) |
| else() |
| if(USE_GAS) |
| - message(WARNING "Could not find working ${CMAKE_SYSTEM_PROCESSOR} GAS assembler\n${ASM_FAILURE_MSG}") |
| + message(WARNING "Could not find working ${CMAKE_HOST_SYSTEM_PROCESSOR} GAS assembler\n${ASM_FAILURE_MSG}") |
| else() |
| message(WARNING "Assembly sources have been disabled\n${ASM_FAILURE_MSG}") |
| endif() |