Skip to content

Commit 3b65124

Browse files
committed
auto merge of #16566 : thestinger/rust/aslr, r=pcwalton
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.
2 parents 01ec6fa + 54cb0f6 commit 3b65124

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc/back/link.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,9 @@ fn link_args(cmd: &mut Command,
14751475

14761476
// Always enable DEP (NX bit) when it is available
14771477
cmd.arg("-Wl,--nxcompat");
1478+
1479+
// Mark all dynamic libraries and executables as compatible with ASLR
1480+
cmd.arg("-Wl,--dynamicbase");
14781481
}
14791482

14801483
if sess.targ_cfg.os == abi::OsAndroid {

0 commit comments

Comments
 (0)