Skip to content

Commit 3d0682b

Browse files
committed
Auto 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 b202532 + 6febaf2 commit 3d0682b

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

compiler/rustc_codegen_llvm/src/back/write.rs

+5-1
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

+1
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ fn test_debugging_options_tracking_hash() {
574574
tracked!(print_fuel, Some("abc".to_string()));
575575
tracked!(profile, true);
576576
tracked!(profile_emit, Some(PathBuf::from("abc")));
577+
tracked!(relax_elf_relocations, Some(true));
577578
tracked!(relro_level, Some(RelroLevel::Full));
578579
tracked!(report_delayed_bugs, true);
579580
tracked!(run_dsymutil, false);

compiler/rustc_session/src/options.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
10321032
"enable queries of the dependency graph for regression testing (default: no)"),
10331033
query_stats: bool = (false, parse_bool, [UNTRACKED],
10341034
"print some statistics about the query system (default: no)"),
1035+
relax_elf_relocations: Option<bool> = (None, parse_opt_bool, [TRACKED],
1036+
"whether ELF relocations can be relaxed"),
10351037
relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
10361038
"choose which RELRO level to use"),
10371039
report_delayed_bugs: bool = (false, parse_bool, [TRACKED],

0 commit comments

Comments
 (0)