Skip to content

Commit

Permalink
Thunks: Fix definition of GUEST_THUNK_LIBRARY
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
neobrain committed Jan 16, 2024
1 parent a63efdb commit 7530146
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions ThunkLibs/Generator/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion ThunkLibs/GuestLibs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down
1 change: 1 addition & 0 deletions ThunkLibs/libfex_thunk_test/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tags: thunklibs|fex_thunk_test

#include "thunkgen_host_libfex_thunk_test.inl"

static_assert(offsetof(ReorderingType, a) == 0);
static uint32_t fexfn_impl_libfex_thunk_test_QueryOffsetOf(guest_layout<ReorderingType*> data, int index) {
if (index == 0) {
return offsetof(guest_layout<ReorderingType>::type, a);
Expand Down
2 changes: 2 additions & 0 deletions unittests/FEXLinuxTests/tests/thunks/thunk_testlib.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define GUEST_THUNK_LIBRARY

#include <dlfcn.h>

#include <stdexcept>
Expand Down

0 comments on commit 7530146

Please sign in to comment.