diff options
| author | Sébastien Marie <semarie@online.fr> | 2021-12-17 11:27:14 +0000 |
|---|---|---|
| committer | Sébastien Marie <semarie@online.fr> | 2021-12-17 11:27:14 +0000 |
| commit | c3da28eade867f731d8169a8c143e33353006e29 (patch) | |
| tree | 852f25ad56cd8993b4935692ac89718b4ccb6214 /compiler/rustc_codegen_ssa/src | |
| parent | 16d8a91d511b0e90391bcb20b8c67036071d9392 (diff) | |
| download | rust-c3da28eade867f731d8169a8c143e33353006e29.tar.gz rust-c3da28eade867f731d8169a8c143e33353006e29.zip | |
pass -Wl,-z,origin to set DF_ORIGIN when using rpath
DF_ORIGIN flag signifies that the object being loaded may make reference to the $ORIGIN substitution string. Some implementations are just ignoring DF_ORIGIN and do substitution for $ORIGIN if present (whatever DF_ORIGIN pr Set the flag inconditionally if rpath is wanted.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/rpath.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/rpath.rs b/compiler/rustc_codegen_ssa/src/back/rpath.rs index 61c3ef62fb1..0b5656c9ad1 100644 --- a/compiler/rustc_codegen_ssa/src/back/rpath.rs +++ b/compiler/rustc_codegen_ssa/src/back/rpath.rs @@ -23,9 +23,12 @@ pub fn get_rpath_flags(config: &mut RPathConfig<'_>) -> Vec<String> { let rpaths = get_rpaths(config); let mut flags = rpaths_to_flags(&rpaths); - // Use DT_RUNPATH instead of DT_RPATH if available if config.linker_is_gnu { + // Use DT_RUNPATH instead of DT_RPATH if available flags.push("-Wl,--enable-new-dtags".to_owned()); + + // Set DF_ORIGIN for substitute $ORIGIN + flags.push("-Wl,-z,origin".to_owned()); } flags |
