aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rust/static-pie.patch
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-05-01 00:43:19 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-05-01 00:43:19 +0200
commit41489596392977197d046ca034685664a3f4afa4 (patch)
treeef791ac83fd7635db59db40e12beb20a66ada3bd /testing/rust/static-pie.patch
parentabfa07f26ff2837922903586b15e137b67b43219 (diff)
downloadaports-41489596392977197d046ca034685664a3f4afa4.tar.bz2
aports-41489596392977197d046ca034685664a3f4afa4.tar.xz
community/rust: move from testing
Diffstat (limited to 'testing/rust/static-pie.patch')
-rw-r--r--testing/rust/static-pie.patch108
1 files changed, 0 insertions, 108 deletions
diff --git a/testing/rust/static-pie.patch b/testing/rust/static-pie.patch
deleted file mode 100644
index 4c4e4b77c1..0000000000
--- a/testing/rust/static-pie.patch
+++ /dev/null
@@ -1,108 +0,0 @@
-From: Shiz <hi@shiz.me>
-Date: Tue, 11 Apr 2017 04:37:00 +0200
-Subject: [PATCH] Add support for static PIE executables
-
-Note that static PIE binaries are reported as dynamically linked by file(1):
-
- $ rustc -C target-feature=+crt-static hello_world.rb
- $ file hello_world
- ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically \
- linked, not stripped, with debug_info
-
-In addition, ldd(1) reports that it's linked with ldd, as it can't find any
-dependencies except itself loaded into the process:
-
- $ ldd hello_world
- ldd (0x237fcc81000)
-
-Static PIE binaries are dynamic binaries without a loader or any DT_NEEDED
-entries. The important is that they do not depend on libc or any other system
-library, just like static binaries, but more secure.
-
- $ readelf -d hello_world
- Dynamic section at offset 0x2de40 contains 17 entries:
- Tag Type Name/Value
- 0x0000000000000010 (SYMBOLIC) 0x0
- 0x000000000000000c (INIT) 0x17a0
- 0x000000000000000d (FINI) 0x2003c
- 0x000000006ffffef5 (GNU_HASH) 0x1c8
- 0x0000000000000005 (STRTAB) 0x278
- 0x0000000000000006 (SYMTAB) 0x200
- 0x000000000000000a (STRSZ) 60 (bytes)
- 0x000000000000000b (SYMENT) 24 (bytes)
- 0x0000000000000015 (DEBUG) 0x0
- 0x0000000000000003 (PLTGOT) 0x22df90
- 0x0000000000000007 (RELA) 0x2b8
- 0x0000000000000008 (RELASZ) 5352 (bytes)
- 0x0000000000000009 (RELAENT) 24 (bytes)
- 0x0000000000000018 (BIND_NOW)
- 0x000000006ffffffb (FLAGS_1) Flags: NOW PIE
- 0x000000006ffffff9 (RELACOUNT) 223
- 0x0000000000000000 (NULL) 0x0
-
---- a/src/librustc_back/target/linux_musl_base.rs
-+++ b/src/librustc_back/target/linux_musl_base.rs
-@@ -22,5 +22,8 @@
- // Except for on MIPS, these targets statically link libc by default.
- base.crt_static_default = true;
-
-+ // Static position-independent executables are supported.
-+ base.static_position_independent_executables = true;
-+
- base
- }
---- a/src/librustc_back/target/mod.rs
-+++ b/src/librustc_back/target/mod.rs
-@@ -350,6 +350,8 @@
- /// the functions in the executable are not randomized and can be used
- /// during an exploit of a vulnerability in any code.
- 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 @@
- has_rpath: false,
- no_default_libraries: true,
- position_independent_executables: false,
-+ static_position_independent_executables: false,
- pre_link_objects_exe: Vec::new(),
- pre_link_objects_dll: Vec::new(),
- post_link_objects: Vec::new(),
---- a/src/librustc_trans/back/link.rs
-+++ b/src/librustc_trans/back/link.rs
-@@ -914,13 +914,9 @@
-
- if crate_type == config::CrateTypeExecutable &&
- t.options.position_independent_executables {
-- let empty_vec = Vec::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 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) {
- cmd.position_independent_executable();
- }
- }
---- a/src/librustc_back/target/mod.rs
-+++ b/src/librustc_back/target/mod.rs
-@@ -612,6 +612,7 @@
- key!(has_rpath, bool);
- key!(no_default_libraries, bool);
- key!(position_independent_executables, bool);
-+ key!(static_position_independent_executables, bool);
- key!(archive_format);
- key!(allow_asm, bool);
- key!(custom_unwind_resume, bool);
-@@ -776,6 +777,7 @@
- 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!(archive_format);
- target_option_val!(allow_asm);
- target_option_val!(custom_unwind_resume);