The intention of this patch is to keep FreeBSD shared libs out of the first 4 GiB of memory in a non-aslr mode (rtld seems to always place them after the executable). In aslr-mode the system does that implicitly (probably because that benefits randomization). The downside is that we fix the entry main address in the aslr-mode as well, making it entirely predictable, which is against the spirit of aslr. Note: -Text-segment is for gcc, --image-base isn't a strict equivalent for clang --- configure.ac.orig 2026-09-18 20:36:23 UTC +++ configure.ac @@ -1100,6 +1100,19 @@ case $host_os in ;; esac ;; + freebsd*) + case $HOST_ARCH in + i386|arm) + WINE_TRY_CFLAGS([-Wl,-Ttext-segment=0x60000000], + [AS_VAR_APPEND([WINELOADER_LDFLAGS],[" -Wl,-Ttext-segment=0x60000000"])], + [WINE_TRY_CFLAGS([-Wl,--section-start,.interp=0x60000400], + [AS_VAR_APPEND([WINELOADER_LDFLAGS],[" -Wl,--section-start,.interp=0x60000400"])])]) + ;; + *) + AS_VAR_APPEND([WINELOADER_LDFLAGS],[" -Wl,-Ttext-segment=0x240000000 -pie"]) + ;; + esac + ;; *) case $HOST_ARCH in i386|arm)