Skip to content

Commit

Permalink
Auto merge of rust-lang#106511 - MaskRay:gotpcrelx, r=nikic
Browse files Browse the repository at this point in the history
Default relax_elf_relocations to true

This option tells LLVM to emit relaxable relocation types R_X86_64_GOTPCRELX/R_X86_64_REX_GOTPCRELX/R_386_GOT32X in applicable cases. True matches Clang's CMake default since 2020-08 [1] and latest LLVM default[2].

This also works around a GNU ld<2.41 issue[2] when using general-dynamic/local-dynamic TLS models in `-Z plt=no` mode with latest LLVM.

[1]: llvm/llvm-project@c41a18c
[2]: llvm/llvm-project@2aedfdd
[3]: https://sourceware.org/bugzilla/show_bug.cgi?id=24784
  • Loading branch information
bors committed Aug 23, 2023
2 parents 249595b + f3d8191 commit 4410868
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ fn test_unstable_options_tracking_hash() {
tracked!(profile_emit, Some(PathBuf::from("abc")));
tracked!(profile_sample_use, Some(PathBuf::from("abc")));
tracked!(profiler_runtime, "abc".to_string());
tracked!(relax_elf_relocations, Some(true));
tracked!(relax_elf_relocations, Some(false));
tracked!(relro_level, Some(RelroLevel::Full));
tracked!(remap_cwd_prefix, Some(PathBuf::from("abc")));
tracked!(report_delayed_bugs, true);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,7 @@ impl Default for TargetOptions {
mcount: "mcount".into(),
llvm_mcount_intrinsic: None,
llvm_abiname: "".into(),
relax_elf_relocations: false,
relax_elf_relocations: true,
llvm_args: cvs![],
use_ctors_section: false,
eh_frame_header: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ pub fn target() -> Target {
position_independent_executables: true,
pre_link_args,
override_export_symbols: Some(EXPORT_SYMBOLS.iter().cloned().map(Cow::from).collect()),
relax_elf_relocations: true,
..Default::default()
};
Target {
Expand Down

0 comments on commit 4410868

Please sign in to comment.