Implement -Z relax-elf-relocations=yes|no

This lets rustc users tweak whether the linker should relax ELF relocations,
namely whether it should emit R_X86_64_GOTPCRELX relocations instead of
R_X86_64_GOTPCREL, as the former is allowed by the ABI to be further
optimised. The default value is whatever the target defines.
This commit is contained in:
Anthony Ramine 2020-10-26 20:55:07 +01:00
parent 3478d7c360
commit 6febaf2419
3 changed files with 8 additions and 1 deletions

View file

@ -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