Skip to content

Commit 92fa615

Browse files
authored
Rollup merge of #78605 - nox:relax-elf-relocations, r=nagisa
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.
2 parents 4a1aec9 + 6febaf2 commit 92fa615

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

compiler/rustc_codegen_llvm/src/back/write.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@ pub fn target_machine_factory(
156156
let emit_stack_size_section = sess.opts.debugging_opts.emit_stack_sizes;
157157

158158
let asm_comments = sess.asm_comments();
159-
let relax_elf_relocations = sess.target.options.relax_elf_relocations;
159+
let relax_elf_relocations = sess
160+
.opts
161+
.debugging_opts
162+
.relax_elf_relocations
163+
.unwrap_or(sess.target.options.relax_elf_relocations);
160164

161165
let use_init_array = !sess
162166
.opts

compiler/rustc_interface/src/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,7 @@ fn test_debugging_options_tracking_hash() {
573573
tracked!(print_fuel, Some("abc".to_string()));
574574
tracked!(profile, true);
575575
tracked!(profile_emit, Some(PathBuf::from("abc")));
576+
tracked!(relax_elf_relocations, Some(true));
576577
tracked!(relro_level, Some(RelroLevel::Full));
577578
tracked!(report_delayed_bugs, true);
578579
tracked!(run_dsymutil, false);

compiler/rustc_session/src/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
10301030
"enable queries of the dependency graph for regression testing (default: no)"),
10311031
query_stats: bool = (false, parse_bool, [UNTRACKED],
10321032
"print some statistics about the query system (default: no)"),
1033+
relax_elf_relocations: Option<bool> = (None, parse_opt_bool, [TRACKED],
1034+
"whether ELF relocations can be relaxed"),
10331035
relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
10341036
"choose which RELRO level to use"),
10351037
report_delayed_bugs: bool = (false, parse_bool, [TRACKED],

0 commit comments

Comments
 (0)