Skip to content

Commit 0d4f919

Browse files
committedDec 14, 2018
Auto merge of rust-lang#56351 - davidtwco:issue-55396-stabilize-linker-flavor, r=nagisa
Stabilize `linker-flavor` flag. Part of rust-lang#55396. This commit moves the linker-flavor flag from a debugging option to a codegen option, thus stabilizing it. There are no feature flags associated with this flag. r? @nagisa

File tree

8 files changed

+12
-98
lines changed

8 files changed

+12
-98
lines changed
 

‎src/doc/rustc/src/codegen-options/index.md

+7
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ This flag lets you append a single extra argument to the linker invocation.
2222
This flag lets you append multiple extra arguments to the linker invocation. The
2323
options should be separated by spaces.
2424

25+
## linker-flavor
26+
27+
This flag lets you control the linker flavor used by `rustc`. If a linker is given with the
28+
`-C linker` flag described above then the linker flavor is inferred from the value provided. If no
29+
linker is given then the linker flavor is used to determine the linker to use. Every `rustc` target
30+
defaults to some linker flavor.
31+
2532
## link-dead-code
2633

2734
Normally, the linker will remove dead code. This flag disables this behavior.

‎src/doc/unstable-book/src/compiler-flags/linker-flavor.md

-61
This file was deleted.

‎src/librustc/session/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
11351135
"enable incremental compilation"),
11361136
default_linker_libraries: Option<bool> = (None, parse_opt_bool, [UNTRACKED],
11371137
"allow the linker to link its default libraries"),
1138+
linker_flavor: Option<LinkerFlavor> = (None, parse_linker_flavor, [UNTRACKED],
1139+
"Linker flavor"),
11381140
}
11391141

11401142
options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
@@ -1297,8 +1299,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
12971299
"pass `-install_name @rpath/...` to the macOS linker"),
12981300
sanitizer: Option<Sanitizer> = (None, parse_sanitizer, [TRACKED],
12991301
"Use a sanitizer"),
1300-
linker_flavor: Option<LinkerFlavor> = (None, parse_linker_flavor, [UNTRACKED],
1301-
"Linker flavor"),
13021302
fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED],
13031303
"set the optimization fuel quota for a crate"),
13041304
print_fuel: Option<String> = (None, parse_opt_string, [TRACKED],

‎src/librustc_codegen_ssa/back/link.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,7 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
192192

193193
// linker and linker flavor specified via command line have precedence over what the target
194194
// specification specifies
195-
if let Some(ret) = infer_from(
196-
sess,
197-
sess.opts.cg.linker.clone(),
198-
sess.opts.debugging_opts.linker_flavor,
199-
) {
195+
if let Some(ret) = infer_from(sess, sess.opts.cg.linker.clone(), sess.opts.cg.linker_flavor) {
200196
return ret;
201197
}
202198

‎src/test/compile-fail/issue-10755.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// compile-flags: -C linker=llllll -Z linker-flavor=ld
11+
// compile-flags: -C linker=llllll -C linker-flavor=ld
1212
// error-pattern: linker `llllll` not found
1313

1414
fn main() {

‎src/test/compile-fail/nolink-with-link-args.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
// error-pattern:aFdEfSeVEE
12-
// compile-flags: -Z linker-flavor=ld
12+
// compile-flags: -C linker-flavor=ld
1313

1414
/* We're testing that link_args are indeed passed when nolink is specified.
1515
So we try to compile with junk link_args and make sure they are visible in

‎src/test/ui/feature-gates/feature-gate-linker-flavor.rs

-20
This file was deleted.

‎src/test/ui/feature-gates/feature-gate-linker-flavor.stderr

-8
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.