Skip to content

Commit

Permalink
Use -O1 for non-GNU linkers
Browse files Browse the repository at this point in the history
  • Loading branch information
emberian committed Nov 24, 2013
1 parent ce45bb7 commit a8a6188
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/librustc/back/link.rs
Expand Up @@ -1099,9 +1099,10 @@ pub fn link_args(sess: Session,
// and binutils 2.22+ won't add them automatically
if sess.targ_cfg.os == abi::OsLinux {
// GNU-style linkers supports optimization with -O. --gc-sections removes metadata and
// potentially other useful things, so don't include it.
// potentially other useful things, so don't include it. GNU ld doesn't need a numeric
// argument, but other linkers do.
if sess.opts.optimize == session::Default || sess.opts.optimize == session::Aggressive {
args.push(~"-Wl,-O");
args.push(~"-Wl,-O1");
}

args.push_all([~"-lrt", ~"-ldl"]);
Expand Down

0 comments on commit a8a6188

Please sign in to comment.