From 7914c5707acd9c9a11a271d2afd804310cabeaf9 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Thu, 12 Nov 2020 10:20:53 +0000 Subject: [PATCH] Fix cross building. When we stopped using CXXFLAGS in eh_personality.s generation, we lost the ability to propagate -m32 or -target through, so cross-compile didn't work. These flags are now passed through correctly, so (so '-pipe -O2' will appear as two arguments, rather than being combined as a single value that then causes clang to abort with an unknown argument error, which was the original motivation for this change). This is the correct fix for #177 --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80b7dfe..cab7857 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -316,8 +316,9 @@ if (ENABLE_OBJCXX) set(ENABLE_OBJCXX false) endif() endif () + separate_arguments(EH_PERSONALITY_FLAGS NATIVE_COMMAND ${CMAKE_CXX_FLAGS}) add_custom_command(OUTPUT eh_trampoline.s - COMMAND ${CMAKE_CXX_COMPILER} -fPIC -S "${CMAKE_SOURCE_DIR}/eh_trampoline.cc" -o - -fexceptions -fno-inline | sed "s/__gxx_personality_v0/test_eh_personality/g" > "${CMAKE_BINARY_DIR}/eh_trampoline.s" + COMMAND ${CMAKE_CXX_COMPILER} ARGS ${EH_PERSONALITY_FLAGS} -fPIC -S "${CMAKE_SOURCE_DIR}/eh_trampoline.cc" ${EH_PERSONALITY_M32} -o - -fexceptions -fno-inline | sed "s/__gxx_personality_v0/test_eh_personality/g" > "${CMAKE_BINARY_DIR}/eh_trampoline.s" MAIN_DEPENDENCY eh_trampoline.cc) list(APPEND libobjc_ASM_SRCS eh_trampoline.s) list(APPEND libobjc_CXX_SRCS objcxx_eh.cc)