From 54cb0f6368bcfe996c65d388a0516ac656c606d0 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 17 Aug 2014 11:02:04 -0400 Subject: [PATCH] mark Windows binaries as compatible with ASLR This is enough for dynamic libraries, but not executables because MinGW does not output a .reloc section even with `--dynamicbase`. It could either be worked around by exporting a DLL symbol from the executable or fixed in MinGW itself. --- src/librustc/back/link.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 03a51ee8db5f7..b475edf77800d 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -1475,6 +1475,9 @@ fn link_args(cmd: &mut Command, // Always enable DEP (NX bit) when it is available cmd.arg("-Wl,--nxcompat"); + + // Mark all dynamic libraries and executables as compatible with ASLR + cmd.arg("-Wl,--dynamicbase"); } if sess.targ_cfg.os == abi::OsAndroid {