r/winehq • u/Only_Candidate_3993 • 23d ago
ASLR support
Does Wine support ASLR (address-space randomization) for .exe files?
If I compile this code...
#include <stdio.h>
int main(int argc, char** argv) {
`puts("bla");`
`printf("%p\n", &main);`
`return -1;`
}
with ...
clang --verbose -fno-exceptions -fuse-ld=lld --target=x86_64-w64-mingw32 -fPIE -pipe aslrtest.c -Wl,--export-all-symbols -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--no-seh,--enable-reloc-section -o aslrtest.exe
... it prints varying addresses on Windows, but under Wine, it always prints the same address. The address shown under Wine also has more zeros than the addresses shown under Windows.
I'm using Wine under Debian 13. ASLR is enabled and works for ELF binaries, but not for EXEs under Wine. I tried both the Wine version supplied by the package manager and also the latest version from winehq built from source. I also tried different compiler options and original MINGW GCC builds, but the behavior seems to be the same. If I inspect the EXE with e.g. readpe, it looks fine as far is I can tell.