I was seeing test failures on platforms with powerpc*, ia64, hppa* CPUs.
The reason is a thinko in the test: The statements
int (*f) (void) = return1;
CODE (f) = start;
modify the function pointer &return1 (!), and then the memcpy invocation
memcpy (start_rw, CODE (return1), 64);
is a no-
On native Windows, instead of skipping the test, we can actually execute it:
Just use VirtualAlloc instead of mmap.
2024-01-08 Bruno Haible
jit/cache tests: Port to native Windows.
* tests/jit/test-cache.c (main): On native Windows, use VirtualAlloc
instead of mmap.
d
I still see test-cache fail on OpenBSD/x86_64. The cause is that due to the
OpenBSD "retguard" stack protector [1][2][3], the functions 'return1' and
'return2' are not position-independent.
This patch fixes it, by turning off the "retguard" stack protector for this
specific compilation unit.
[1]
Testing the jit/cache module on various x86_64 platforms, I see test failures:
- On CentOS. Here the problem is that pagealign_alloc returns a piece of memory
with PROT_READ | PROT_WRITE access. The mprotect that wants to install
a PROT_EXEC access then fails. The solution is to give the right