From b08d372c7805590cfc2dd397232e1dcf99c2d56c Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Wed, 10 Jan 2024 22:34:10 +0100 Subject: [PATCH] Thunks: Fix definition of GUEST_THUNK_LIBRARY The -deps target is the wrong target to add this to, since its compile flags are propagated to both Guest.cpp and Host.cpp. Instead, define the flag only when processing files within a guest context. --- ThunkLibs/Generator/main.cpp | 1 + ThunkLibs/GuestLibs/CMakeLists.txt | 1 - unittests/FEXLinuxTests/tests/thunks/thunk_testlib.cpp | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ThunkLibs/Generator/main.cpp b/ThunkLibs/Generator/main.cpp index 726e5cbfa..d238fc1ea 100644 --- a/ThunkLibs/Generator/main.cpp +++ b/ThunkLibs/Generator/main.cpp @@ -77,6 +77,7 @@ int main(int argc, char* const argv[]) { AdjustedArgs.push_back(std::string { "--target=" } + platform + "-linux-unknown"); AdjustedArgs.push_back("-isystem"); AdjustedArgs.push_back(std::string { "/usr/" } + platform + "-linux-gnu/include/"); + AdjustedArgs.push_back("-DGUEST_THUNK_LIBRARY"); return AdjustedArgs; }; GuestTool.appendArgumentsAdjuster(append_guest_args); diff --git a/ThunkLibs/GuestLibs/CMakeLists.txt b/ThunkLibs/GuestLibs/CMakeLists.txt index d32266516..62cb78c43 100644 --- a/ThunkLibs/GuestLibs/CMakeLists.txt +++ b/ThunkLibs/GuestLibs/CMakeLists.txt @@ -51,7 +51,6 @@ function(generate NAME SOURCE_FILE) # Interface target for the user to add include directories add_library(${NAME}-guest-deps INTERFACE) target_include_directories(${NAME}-guest-deps INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/../include") - target_compile_definitions(${NAME}-guest-deps INTERFACE GUEST_THUNK_LIBRARY) if (BITNESS EQUAL 32) target_compile_definitions(${NAME}-guest-deps INTERFACE IS_32BIT_THUNK) endif () diff --git a/unittests/FEXLinuxTests/tests/thunks/thunk_testlib.cpp b/unittests/FEXLinuxTests/tests/thunks/thunk_testlib.cpp index c1ae5c564..183a5c31d 100644 --- a/unittests/FEXLinuxTests/tests/thunks/thunk_testlib.cpp +++ b/unittests/FEXLinuxTests/tests/thunks/thunk_testlib.cpp @@ -1,3 +1,5 @@ +#define GUEST_THUNK_LIBRARY + #include #include