[compiler-rt] [compiler-rt] Intercept MinGW x86-64 import thunks (PR #222710)
Thurston Dang via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 10:52:08 PDT 2026
================
@@ -1122,6 +1122,33 @@ bool OverrideFunctionWithDetour(
bool OverrideFunctionWithRedirectJump(
uptr old_func, uptr new_func, uptr *orig_old_func) {
+# if SANITIZER_WINDOWS64 && defined(__GNUC__) && !defined(__clang__)
+ u8* old_u8 = (u8*)old_func;
+
+ // Relative indirect jump.
+ if (old_u8[0] == 0xff && old_u8[1] == 0x25) {
+ sptr relative_offset = *(s32*)(old_func + 2);
+ uptr* absolute_target_ptr = (uptr*)(old_func + 6 + relative_offset);
----------------
thurstond wrote:
Nit: replace 6 with kIndirectJumpInstructionLength (currently defined as UNUSED in interception_win.cpp)
https://github.com/llvm/llvm-project/pull/222710
More information about the llvm-commits
mailing list