Skip to content

Commit a8a6188

Browse files
committed
Use -O1 for non-GNU linkers
1 parent ce45bb7 commit a8a6188

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/librustc/back/link.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,9 +1099,10 @@ pub fn link_args(sess: Session,
10991099
// and binutils 2.22+ won't add them automatically
11001100
if sess.targ_cfg.os == abi::OsLinux {
11011101
// GNU-style linkers supports optimization with -O. --gc-sections removes metadata and
1102-
// potentially other useful things, so don't include it.
1102+
// potentially other useful things, so don't include it. GNU ld doesn't need a numeric
1103+
// argument, but other linkers do.
11031104
if sess.opts.optimize == session::Default || sess.opts.optimize == session::Aggressive {
1104-
args.push(~"-Wl,-O");
1105+
args.push(~"-Wl,-O1");
11051106
}
11061107

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

0 commit comments

Comments
 (0)