Skip to content

Commit

Permalink
Stabilize linker-flavor flag.
Browse files Browse the repository at this point in the history
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
davidtwco committed Dec 13, 2018
1 parent d8046ed commit 9536d04
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
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
Expand Up @@ -1136,6 +1136,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 @@ -1292,8 +1294,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
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
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
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 9536d04

Please sign in to comment.