diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/back/link.rs index 7169b79c3bc36..a51603e61fb99 100644 --- a/src/librustc_codegen_ssa/back/link.rs +++ b/src/librustc_codegen_ssa/back/link.rs @@ -505,10 +505,10 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( cmd.args(args); } } - if let Some(ref args) = sess.opts.debugging_opts.pre_link_args { + if let Some(ref args) = sess.opts.cg.pre_link_args { cmd.args(args); } - cmd.args(&sess.opts.debugging_opts.pre_link_arg); + cmd.args(&sess.opts.cg.pre_link_arg); if sess.target.target.options.is_like_fuchsia { let prefix = match sess.opts.debugging_opts.sanitizer { diff --git a/src/librustc_session/options.rs b/src/librustc_session/options.rs index e43908a79143b..118460b9b6b57 100644 --- a/src/librustc_session/options.rs +++ b/src/librustc_session/options.rs @@ -636,6 +636,10 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, "a single extra argument to append to the linker invocation (can be used several times)"), link_args: Option> = (None, parse_opt_list, [UNTRACKED], "extra arguments to append to the linker invocation (space separated)"), + pre_link_arg: Vec = (vec![], parse_string_push, [UNTRACKED], + "a single extra argument to prepend the linker invocation (can be used several times)"), + pre_link_args: Option> = (None, parse_opt_list, [UNTRACKED], + "extra arguments to prepend to the linker invocation (space separated)"), link_dead_code: bool = (false, parse_bool, [UNTRACKED], "don't let linker strip dead code (turning it on can be used for code coverage)"), lto: LtoCli = (LtoCli::Unspecified, parse_lto, [TRACKED], @@ -863,10 +867,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "make rustc print the total optimization fuel used by a crate"), force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED], "force all crates to be `rustc_private` unstable"), - pre_link_arg: Vec = (vec![], parse_string_push, [UNTRACKED], - "a single extra argument to prepend the linker invocation (can be used several times)"), - pre_link_args: Option> = (None, parse_opt_list, [UNTRACKED], - "extra arguments to prepend to the linker invocation (space separated)"), profile: bool = (false, parse_bool, [TRACKED], "insert profiling code"), relro_level: Option = (None, parse_relro_level, [TRACKED],