Skip to content

Commit

Permalink
mark Windows binaries as compatible with ASLR
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thestinger committed Aug 17, 2014
1 parent a12a4dd commit 54cb0f6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/librustc/back/link.rs
Expand Up @@ -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 {
Expand Down

5 comments on commit 54cb0f6

@bors
Copy link
Contributor

@bors bors commented on 54cb0f6 Aug 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 54cb0f6 Aug 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging thestinger/rust/aslr = 54cb0f6 into auto

@bors
Copy link
Contributor

@bors bors commented on 54cb0f6 Aug 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thestinger/rust/aslr = 54cb0f6 merged ok, testing candidate = 3b65124

@bors
Copy link
Contributor

@bors bors commented on 54cb0f6 Aug 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 3b65124

Please sign in to comment.