Merge pull request #3461 from SChernykh/dev

RandomX: check pointer sizes during JIT initialization
This commit is contained in:
xmrig 2024-04-14 05:38:53 +07:00 committed by GitHub
commit 9fbdcc0ef0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -260,6 +260,7 @@ typedef void(randomx::JitCompilerX86::* InstructionGeneratorX86_2)(const randomx
#define JIT_HANDLE(x, prev) do { \ #define JIT_HANDLE(x, prev) do { \
const InstructionGeneratorX86_2 p = &randomx::JitCompilerX86::h_##x; \ const InstructionGeneratorX86_2 p = &randomx::JitCompilerX86::h_##x; \
static_assert(sizeof(p) == sizeof(randomx::JitCompilerX86::engine[k]), "Pointer size mismatch"); \
memcpy(randomx::JitCompilerX86::engine + k, &p, sizeof(p)); \ memcpy(randomx::JitCompilerX86::engine + k, &p, sizeof(p)); \
} while (0) } while (0)