diff options
Diffstat (limited to 'testing/rust/static-pie.patch')
-rw-r--r-- | testing/rust/static-pie.patch | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/testing/rust/static-pie.patch b/testing/rust/static-pie.patch index babfbfaf7f..4c4e4b77c1 100644 --- a/testing/rust/static-pie.patch +++ b/testing/rust/static-pie.patch @@ -72,21 +72,19 @@ library, just like static binaries, but more secure. post_link_objects: Vec::new(), --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs -@@ -846,15 +846,12 @@ +@@ -914,13 +914,9 @@ if crate_type == config::CrateTypeExecutable && t.options.position_independent_executables { - let empty_vec = Vec::new(); - let empty_str = String::new(); - let args = sess.opts.cg.link_args.as_ref().unwrap_or(&empty_vec); - let more_args = &sess.opts.cg.link_arg; - let mut args = args.iter().chain(more_args.iter()).chain(used_link_args.iter()); - let relocation_model = sess.opts.cg.relocation_model.as_ref() - .unwrap_or(&empty_str); +- + let static_pie = t.options.static_position_independent_executables; - if (t.options.relocation_model == "pic" || *relocation_model == "pic") + if get_reloc_model(sess) == llvm::RelocMode::PIC - && !args.any(|x| *x == "-static") { -+ && (static_pie || !sess.fully_static()) { ++ && (!sess.fully_static() || static_pie) { cmd.position_independent_executable(); } } |