about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2014-08-17 11:02:04 -0400
committerDaniel Micay <danielmicay@gmail.com>2014-08-17 17:17:20 -0400
commit54cb0f6368bcfe996c65d388a0516ac656c606d0 (patch)
tree8bd5bf249bdc8904566dafb17565a57368ba94e7 /src
parenta12a4ddcfabb80d6224960f19d6043f88f47d1e6 (diff)
downloadrust-54cb0f6368bcfe996c65d388a0516ac656c606d0.tar.gz
rust-54cb0f6368bcfe996c65d388a0516ac656c606d0.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/librustc/back/link.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 03a51ee8db5..b475edf7780 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 {