Skip to content

Commit

Permalink
Rollup merge of rust-lang#56351 - davidtwco:issue-55396-stabilize-lin…
Browse files Browse the repository at this point in the history
…ker-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.
  • Loading branch information
kennytm committed Dec 13, 2018
2 parents 055e288 + 9536d04 commit 85fc7af
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 98 deletions.
7 changes: 7 additions & 0 deletions src/doc/rustc/src/codegen-options/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ This flag lets you append a single extra argument to the linker invocation.
This flag lets you append multiple extra arguments to the linker invocation. The
options should be separated by spaces.

## linker-flavor

This flag lets you control the linker flavor used by `rustc`. If a linker is given with the
`-C linker` flag described above then the linker flavor is inferred from the value provided. If no
linker is given then the linker flavor is used to determine the linker to use. Every `rustc` target
defaults to some linker flavor.

## link-dead-code

Normally, the linker will remove dead code. This flag disables this behavior.
Expand Down
61 changes: 0 additions & 61 deletions src/doc/unstable-book/src/compiler-flags/linker-flavor.md

This file was deleted.

4 changes: 2 additions & 2 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
"enable incremental compilation"),
default_linker_libraries: Option<bool> = (None, parse_opt_bool, [UNTRACKED],
"allow the linker to link its default libraries"),
linker_flavor: Option<LinkerFlavor> = (None, parse_linker_flavor, [UNTRACKED],
"Linker flavor"),
}

options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
Expand Down Expand Up @@ -1297,8 +1299,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"pass `-install_name @rpath/...` to the macOS linker"),
sanitizer: Option<Sanitizer> = (None, parse_sanitizer, [TRACKED],
"Use a sanitizer"),
linker_flavor: Option<LinkerFlavor> = (None, parse_linker_flavor, [UNTRACKED],
"Linker flavor"),
fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED],
"set the optimization fuel quota for a crate"),
print_fuel: Option<String> = (None, parse_opt_string, [TRACKED],
Expand Down
6 changes: 1 addition & 5 deletions src/librustc_codegen_ssa/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,7 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {

// linker and linker flavor specified via command line have precedence over what the target
// specification specifies
if let Some(ret) = infer_from(
sess,
sess.opts.cg.linker.clone(),
sess.opts.debugging_opts.linker_flavor,
) {
if let Some(ret) = infer_from(sess, sess.opts.cg.linker.clone(), sess.opts.cg.linker_flavor) {
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-10755.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

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

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/nolink-with-link-args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

// error-pattern:aFdEfSeVEE
// compile-flags: -Z linker-flavor=ld
// compile-flags: -C linker-flavor=ld

/* We're testing that link_args are indeed passed when nolink is specified.
So we try to compile with junk link_args and make sure they are visible in
Expand Down
20 changes: 0 additions & 20 deletions src/test/ui/feature-gates/feature-gate-linker-flavor.rs

This file was deleted.

8 changes: 0 additions & 8 deletions src/test/ui/feature-gates/feature-gate-linker-flavor.stderr

This file was deleted.

0 comments on commit 85fc7af

Please sign in to comment.