Skip to content

Commit

Permalink
Rollup merge of rust-lang#78605 - nox:relax-elf-relocations, r=nagisa
Browse files Browse the repository at this point in the history
Implement -Z relax-elf-relocations=yes|no

This lets rustc users tweak whether the linker should relax ELF relocations without recompiling a whole new target with its own libcore etc.
  • Loading branch information
m-ou-se authored Nov 1, 2020
2 parents 4a1aec9 + 6febaf2 commit 92fa615
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ pub fn target_machine_factory(
let emit_stack_size_section = sess.opts.debugging_opts.emit_stack_sizes;

let asm_comments = sess.asm_comments();
let relax_elf_relocations = sess.target.options.relax_elf_relocations;
let relax_elf_relocations = sess
.opts
.debugging_opts
.relax_elf_relocations
.unwrap_or(sess.target.options.relax_elf_relocations);

let use_init_array = !sess
.opts
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ fn test_debugging_options_tracking_hash() {
tracked!(print_fuel, Some("abc".to_string()));
tracked!(profile, true);
tracked!(profile_emit, Some(PathBuf::from("abc")));
tracked!(relax_elf_relocations, Some(true));
tracked!(relro_level, Some(RelroLevel::Full));
tracked!(report_delayed_bugs, true);
tracked!(run_dsymutil, false);
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"enable queries of the dependency graph for regression testing (default: no)"),
query_stats: bool = (false, parse_bool, [UNTRACKED],
"print some statistics about the query system (default: no)"),
relax_elf_relocations: Option<bool> = (None, parse_opt_bool, [TRACKED],
"whether ELF relocations can be relaxed"),
relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
"choose which RELRO level to use"),
report_delayed_bugs: bool = (false, parse_bool, [TRACKED],
Expand Down

0 comments on commit 92fa615

Please sign in to comment.