From 5d555a10a2ba591d8b5c0da066bc7a3bb96746d2 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Thu, 10 Feb 2022 12:07:19 +0100 Subject: [PATCH] Thunks: Explicitly put thunks into the text library section Previously, defining zero-initialized variables right before LOAD_LIB could cause the compiler to put thunk definitions into bss, hence triggering errors during assembly ("attempt to store non-zero value in section `.bss'"). --- ThunkLibs/include/common/Guest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThunkLibs/include/common/Guest.h b/ThunkLibs/include/common/Guest.h index e994427c2..29775f6cf 100644 --- a/ThunkLibs/include/common/Guest.h +++ b/ThunkLibs/include/common/Guest.h @@ -4,7 +4,7 @@ #ifndef _M_ARM_64 #define MAKE_THUNK(lib, name, hash) \ extern "C" int fexthunks_##lib##_##name(void *args); \ - asm("fexthunks_" #lib "_" #name ":\n.byte 0xF, 0x3F\n.byte " hash ); + asm(".text\nfexthunks_" #lib "_" #name ":\n.byte 0xF, 0x3F\n.byte " hash ); #else // We're compiling for IDE integration, so provide a dummy-implementation that just calls an undefined function. // The name of that function serves as an error message if this library somehow gets loaded at runtime.