aboutsummaryrefslogtreecommitdiffstats
path: root/community/rust/static-pie.patch
diff options
context:
space:
mode:
Diffstat (limited to 'community/rust/static-pie.patch')
-rw-r--r--community/rust/static-pie.patch19
1 files changed, 11 insertions, 8 deletions
diff --git a/community/rust/static-pie.patch b/community/rust/static-pie.patch
index 4c4e4b77c1..daee42f286 100644
--- a/community/rust/static-pie.patch
+++ b/community/rust/static-pie.patch
@@ -59,14 +59,15 @@ library, just like static binaries, but more secure.
pub position_independent_executables: bool,
+ /// As above, but also support for static position independent executables.
+ pub static_position_independent_executables: bool,
- /// Format that archives should be emitted in. This affects whether we use
- /// LLVM to assemble an archive or fall back to the system linker, and
- /// currently only "gnu" is used to fall into LLVM. Unknown strings cause
-@@ -434,6 +436,7 @@
+ /// Either partial, full, or off. Full RELRO makes the dynamic linker
+ /// resolve all symbols at startup and marks the GOT read-only before
+ /// starting the program, preventing overwriting the GOT.
+@@ -434,7 +436,8 @@
has_rpath: false,
no_default_libraries: true,
position_independent_executables: false,
+ static_position_independent_executables: false,
+ relro_level: RelroLevel::Off,
pre_link_objects_exe: Vec::new(),
pre_link_objects_dll: Vec::new(),
post_link_objects: Vec::new(),
@@ -83,26 +84,28 @@ library, just like static binaries, but more secure.
-
+ let static_pie = t.options.static_position_independent_executables;
if get_reloc_model(sess) == llvm::RelocMode::PIC
-- && !args.any(|x| *x == "-static") {
-+ && (!sess.fully_static() || static_pie) {
+- && !sess.crt_static() && !args.any(|x| *x == "-static") {
++ && (!sess.crt_static() || static_pie) {
cmd.position_independent_executable();
}
}
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
-@@ -612,6 +612,7 @@
+@@ -612,7 +612,8 @@
key!(has_rpath, bool);
key!(no_default_libraries, bool);
key!(position_independent_executables, bool);
+ key!(static_position_independent_executables, bool);
+ try!(key!(relro_level, RelroLevel));
key!(archive_format);
key!(allow_asm, bool);
key!(custom_unwind_resume, bool);
-@@ -776,6 +777,7 @@
+@@ -776,7 +777,8 @@
target_option_val!(has_rpath);
target_option_val!(no_default_libraries);
target_option_val!(position_independent_executables);
+ target_option_val!(static_position_independent_executables);
+ target_option_val!(relro_level);
target_option_val!(archive_format);
target_option_val!(allow_asm);
target_option_val!(custom_unwind_resume);