diff options
-rw-r--r-- | community/rust/APKBUILD | 25 | ||||
-rw-r--r-- | community/rust/alpine-change-rpath-to-rustlib.patch | 7 | ||||
-rw-r--r-- | community/rust/alpine-move-py-scripts-to-share.patch | 2 | ||||
-rw-r--r-- | community/rust/alpine-target.patch | 2 | ||||
-rw-r--r-- | community/rust/llvm-with-ffi.patch | 6 | ||||
-rw-r--r-- | community/rust/musl-fix-linux_musl_base.patch | 2 | ||||
-rw-r--r-- | community/rust/musl-fix-static-linking.patch | 85 | ||||
-rw-r--r-- | community/rust/need-rpath.patch | 12 | ||||
-rw-r--r-- | community/rust/static-pie.patch | 44 |
9 files changed, 57 insertions, 128 deletions
diff --git a/community/rust/APKBUILD b/community/rust/APKBUILD index a606659728..15a5576b8e 100644 --- a/community/rust/APKBUILD +++ b/community/rust/APKBUILD @@ -3,9 +3,10 @@ # Contributor: Jeizsm <jeizsm@gmail.com> # Maintainer: Jakub Jirutka <jakub@jirutka.cz> pkgname=rust -pkgver=1.25.0 -_llvmver=4 -_bootver=1.24.0 +pkgver=1.26.0 +# TODO: bump to 6 as soon as we add llvm6 +_llvmver=5 +_bootver=1.25.0 pkgrel=0 pkgdesc="The Rust Programming Language" url="http://www.rust-lang.org" @@ -187,15 +188,15 @@ _mv() { mv $@ } -sha512sums="7d8886f4d5a621eb794e814deb60be681fa38cf086f87ffa14e5a3500c640b237c549a632de1331a0f1b71963de41f6d31a4df3866b7e597424002316fed81ce rustc-1.25.0-src.tar.gz -cee98ff6cded8a330e383b8b88423b10b7c2cdcb711b31f4685abae7a60f85869e87f3096eb2d90a83dafeeba98b6f153b5e67d88f5cacc368dc53c701fe495b musl-fix-static-linking.patch -360b0c1b6374cb356989b6f254da2dfc2ab2390c8251f0151492206b908ebf85c6ff57405394b3f46f1fc3e26f7c986bb9e924065f4c4dfa1d50fff2a99b5cd0 musl-fix-linux_musl_base.patch -dc6432293bd060d5e3a73f25870867654fae61995dcd919e244a2dc686b6107556deed8c59ca6002182bfeff5ebc1ca2b89c4028ab0fbfb79e65defe47c9b4b0 llvm-with-ffi.patch -936ddccb357307b3f7f3c10aadcdc3dfbbe0ccb8cc5675969a87b7cf1a8e72f73ed5118c6cd6a1a36a377457ead998cc8c71f4176361acb4416ec16673b4c597 static-pie.patch -b5c8a4faf3571b5c79b052103639ea3b14f094ec0999963602111608afa1159219f958decf0b45dd409124b318f5e17af47b4e74207a9f1c9648a9572dc68cca need-rpath.patch +sha512sums="6b0eac18eef1093dad4cbb57fccbc22a2e0b11459c11600c66eef539fa1972bbae2d89751e2d46a32a46a4572fd0d3264b1083bd13d9749b694e00cd4b3d8acc rustc-1.26.0-src.tar.gz +d26b0c87e2dce9f2aca561a47ed1ca987c4e1b272ab8b19c39433b63d4be03ca244ba97adc50e743fe50eb0b2f8109cd68a2f05e41d7411c58ef77ef253ca789 musl-fix-static-linking.patch +ed209fa8e44764fce9e38f46006910d632b81708be5d84d281aa40cf4f78fb9f8ccb0dcac55cb4e5a5855a4e52fc322b72772006c5d5d1d4545cf2668e60f381 musl-fix-linux_musl_base.patch +e40d41a6dc5d400d6672f1836cd5b9e00391f7beb52e872d87db76bc95a606ce6aaae737a0256a1e5fba77c83bb223818d214dbe87028d47be65fb43c101595c llvm-with-ffi.patch +a8ae797e487cb7722b2c88a641ae850d65997d296b1f9672d0ec23caff99846c6f2eaa27eb449fec31c51c3d490aee2900e722c3435fab95ed55a22fda583168 static-pie.patch +7bf81f58935e56ab673ce85e0c81b94cfb78a5bfbb8c220683a4cf71d75dfdf3861300abf3867c46594d2db894d00e5c8f65983a2b9bfe8966582adfa7d149e3 need-rpath.patch d352614e7c774e181decae210140e789de7fc090327ff371981ad28a11ce51c8c01b27c1101a24bb84d75ed2f706f67868f7dbc52196d4ccdf4ebd2d6d6b6b5e minimize-rpath.patch -498f4649163974afc4f042c43cd0c15d36784031514201a2962061f288a9336c2bc9749f8d2308b8ce3656f8097b5fc5bef505f61e2a6ed422ef4153f5339d77 alpine-move-py-scripts-to-share.patch -0542e8ffeb7ff6017aeec84d99c14802c6536433b41dafe7c8fc0c40908548228f34ef142ad6ad94235115b05f02ce157553b470b0f242292f90f3125b249e94 alpine-change-rpath-to-rustlib.patch -9b451a7c4a761ff7e5f269cd5f84e59afbaedc8ef5d1d053cd3e315ce8d99f1a25fa7291e5dacb3cfbac32b4d15518a616bd703ab28844484285929e71dd2720 alpine-target.patch +0c0aa7eeddeb578c320a94696a4437fbf083ef4d6f8049512de82548285f37ec4460b5d04f087dc303a5f62a09b5d13b7f0c4fbbdb0b321147ae030e7282ac07 alpine-move-py-scripts-to-share.patch +61aa415d754e9e01236481a1f3c9d5242f2d633e6f11b998e9ffcc07bf5c182d87c0c973dab6f10e4bb3ab4b4a4857bf9ed8dd664c49a65f6175d27db2774db1 alpine-change-rpath-to-rustlib.patch +b3be85bf54d03ba5a685c8e01246e047a169fedb1745182286fdb1ae8cb23e6723318276ef36ee0c54bf7e6d2bc86a46c479fb6c822b8b548d35fa094dde05d2 alpine-target.patch 7d59258d4462eba0207739a5c0c8baf1f19d9a396e5547bb4d59d700eb94d50ba6add2e523f3e94e29e993821018594625ea4ac86304fb58f7f8c82622a26ab0 install-template-shebang.patch 79549055dea81379c890b495c82456ab497a9179ec6702c59e11d0748bc668f47fc3d6a69c27a0545bb87c01318631dffc69260bf2d4badc75f53cbf7fad7528 check-rustc" diff --git a/community/rust/alpine-change-rpath-to-rustlib.patch b/community/rust/alpine-change-rpath-to-rustlib.patch index bd65efd7d9..609fdde358 100644 --- a/community/rust/alpine-change-rpath-to-rustlib.patch +++ b/community/rust/alpine-change-rpath-to-rustlib.patch @@ -1,5 +1,6 @@ From: Jakub Jirutka <jakub@jirutka.cz> Date: Sat, 08 Aug 2016 19:56:00 +0200 +Last-Updated: Sun, 20 May 2018 00:09:00 +0200 Subject: [PATCH] Change rpath for rustc/rustdoc to rustlib/$TARGET/lib Rust installs two identical sets of *.so libraries into /usr/lib and @@ -23,11 +24,13 @@ Related upstream issues: --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs -@@ -189,7 +189,7 @@ +@@ -224,9 +224,9 @@ + // so. Note that this is definitely a hack, and we should likely + // flesh out rpath support more fully in the future. cmd.arg("-Z").arg("osx-rpath-install-name"); - Some("-Wl,-rpath,@loader_path/../lib") + Some("-Wl,-rpath,@loader_path/../lib".to_string()) - } else if !target.contains("windows") { + } else if !target.contains("windows") && !target.contains("wasm32") { - Some("-Wl,-rpath,$ORIGIN/../lib") + Some(format!("-Wl,-rpath,$ORIGIN/../lib/rustlib/{}/lib", target)) } else { diff --git a/community/rust/alpine-move-py-scripts-to-share.patch b/community/rust/alpine-move-py-scripts-to-share.patch index dcab4abd81..261e62a84a 100644 --- a/community/rust/alpine-move-py-scripts-to-share.patch +++ b/community/rust/alpine-move-py-scripts-to-share.patch @@ -8,7 +8,7 @@ +GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/share/rust/etc" # Run GDB with the additional arguments that load the pretty printers - PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" gdb \ + # Set the environment variable `RUST_GDB` to overwrite the call to a --- a/src/etc/rust-lldb +++ b/src/etc/rust-lldb @@ -33,7 +33,7 @@ diff --git a/community/rust/alpine-target.patch b/community/rust/alpine-target.patch index 8b3a914ab4..f5425a5e78 100644 --- a/community/rust/alpine-target.patch +++ b/community/rust/alpine-target.patch @@ -9,7 +9,7 @@ and distribution-specific quirks instead of polluting the main musl target of --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs -@@ -234,6 +234,11 @@ +@@ -239,6 +239,11 @@ ("armv7-unknown-cloudabi-eabihf", armv7_unknown_cloudabi_eabihf), ("i686-unknown-cloudabi", i686_unknown_cloudabi), ("x86_64-unknown-cloudabi", x86_64_unknown_cloudabi), diff --git a/community/rust/llvm-with-ffi.patch b/community/rust/llvm-with-ffi.patch index 42b0895e75..b3dd209dc9 100644 --- a/community/rust/llvm-with-ffi.patch +++ b/community/rust/llvm-with-ffi.patch @@ -7,9 +7,9 @@ https://github.com/rust-lang/rust/issues/34486. --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs -@@ -432,3 +432,6 @@ - mod llvmdeps { - include! { env!("CFG_LLVM_LINKAGE_FILE") } +@@ -422,3 +422,6 @@ + } + } } + +#[link(name = "ffi")] diff --git a/community/rust/musl-fix-linux_musl_base.patch b/community/rust/musl-fix-linux_musl_base.patch index 7b2f26895c..df7da501e0 100644 --- a/community/rust/musl-fix-linux_musl_base.patch +++ b/community/rust/musl-fix-linux_musl_base.patch @@ -6,7 +6,7 @@ See https://github.com/rust-lang/rust/pull/40113 --- a/src/librustc_back/target/linux_musl_base.rs +++ b/src/librustc_back/target/linux_musl_base.rs -@@ -13,54 +13,14 @@ +@@ -14,54 +14,14 @@ pub fn opts() -> TargetOptions { let mut base = super::linux_base::opts(); diff --git a/community/rust/musl-fix-static-linking.patch b/community/rust/musl-fix-static-linking.patch index fe9b39ea64..c697785ab8 100644 --- a/community/rust/musl-fix-static-linking.patch +++ b/community/rust/musl-fix-static-linking.patch @@ -1,13 +1,10 @@ From: Shiz <hi@shiz.me> Date: Fri, 21 Apr 2017 01:04:46 +0200 +Last-Updated: Sat, 19 May 2018 23:54:30 +0200 Subject: [PATCH] Support fully static linking on *nix targets It adds the proper linker argument for static result objects to `Linker` -and implements them for `GnuLinker` and `MsvcLinker`. Additionally, when -statically linking, all the objects are linked in a group (-Wl,-( and -Wl,-) -on GNU-compatible linkers) to resolve dependency and order issues that may -normally arise. For `MsvcLinker`, this is a no-op as it already exhibits -this behavior by default. +and implements them for `GnuLinker` and `MsvcLinker`. Finally, if no linking preference is given for native libraries (`NativeLibraryKind::NativeUnknown`), they are linked statically if full @@ -15,32 +12,11 @@ static linking is requested, instead of dynamically as before. --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs -@@ -951,17 +951,12 @@ - // list can't depend on items higher up in the list. For example nothing can - // depend on what we just generated (e.g. that'd be a circular dependency). - // Upstream rust libraries are not allowed to depend on our local native -- // libraries as that would violate the structure of the DAG, in that -- // scenario they are required to link to them as well in a shared fashion. -- // -- // Note that upstream rust libraries may contain native dependencies as -- // well, but they also can't depend on what we just started to add to the -- // link line. And finally upstream native libraries can't depend on anything -- // in this DAG so far because they're only dylibs and dylibs can only depend -- // on other dylibs (e.g. other native deps). -+ // libraries as that would violate the structure of the DAG. -+ cmd.start_group(); - add_local_native_libraries(cmd, sess, trans); - add_upstream_rust_crates(cmd, sess, trans, crate_type, tmpdir); - add_upstream_native_libraries(cmd, sess, trans, crate_type); -+ cmd.end_group(); - - // # Telling the linker what we're doing - -@@ -983,13 +983,13 @@ - let relevant_libs = sess.cstore.used_libraries().into_iter().filter(|l| { +@@ -1151,13 +1151,13 @@ + let relevant_libs = trans.crate_info.used_libraries.iter().filter(|l| { relevant_lib(sess, l) }); - + let search_path = archive_search_paths(sess); for lib in relevant_libs { match lib.kind { @@ -51,54 +27,3 @@ static linking is requested, instead of dynamically as before. NativeLibraryKind::NativeStatic => cmd.link_whole_staticlib(&lib.name.as_str(), &search_path) } ---- a/src/librustc_trans/back/linker.rs -+++ b/src/librustc_trans/back/linker.rs -@@ -116,6 +116,8 @@ pub trait Linker { - fn subsystem(&mut self, subsystem: &str); - // Should have been finalize(self), but we don't support self-by-value on trait objects (yet?). - fn finalize(&mut self) -> Command; -+ fn start_group(&mut self); -+ fn end_group(&mut self); - } - - pub struct GccLinker<'a> { -@@ -178,6 +180,8 @@ impl<'a> Linker for GccLinker<'a> { - fn output_filename(&mut self, path: &Path) { self.cmd.arg("-o").arg(path); } - fn add_object(&mut self, path: &Path) { self.cmd.arg(path); } - fn position_independent_executable(&mut self) { self.cmd.arg("-pie"); } -+ fn start_group(&mut self) { self.cmd.arg("-Wl,-("); } -+ fn end_group(&mut self) { self.cmd.arg("-Wl,-)"); } - fn partial_relro(&mut self) { self.linker_arg("-z,relro"); } - fn full_relro(&mut self) { self.linker_arg("-z,relro,-z,now"); } - fn build_static_executable(&mut self) { self.cmd.arg("-static"); } -@@ -577,6 +581,15 @@ impl<'a> Linker for MsvcLinker<'a> { - } - } - -+ -+ fn start_group(&mut self) { -+ // Not needed -+ } -+ -+ fn end_group(&mut self) { -+ // Not needed -+ } -+ - fn finalize(&mut self) -> Command { - let mut cmd = Command::new(""); - ::std::mem::swap(&mut cmd, &mut self.cmd); -@@ -727,6 +740,14 @@ impl<'a> Linker for EmLinker<'a> { - // noop - } - -+ fn start_group(&mut self) { -+ self.cmd.arg("-Wl,-("); -+ } -+ -+ fn end_group(&mut self) { -+ self.cmd.arg("-Wl,-)"); -+ } -+ - fn finalize(&mut self) -> Command { - let mut cmd = Command::new(""); - ::std::mem::swap(&mut cmd, &mut self.cmd); diff --git a/community/rust/need-rpath.patch b/community/rust/need-rpath.patch index 88cc9d8882..d7689610b9 100644 --- a/community/rust/need-rpath.patch +++ b/community/rust/need-rpath.patch @@ -13,7 +13,7 @@ Hacky hacky! --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs -@@ -341,6 +341,8 @@ +@@ -379,6 +379,8 @@ pub allows_weak_linkage: bool, /// Whether the linker support rpaths or not. Defaults to false. pub has_rpath: bool, @@ -22,7 +22,7 @@ Hacky hacky! /// Whether to disable linking to the default libraries, typically corresponds /// to `-nodefaultlibs`. Defaults to true. pub no_default_libraries: bool, -@@ -434,6 +436,7 @@ +@@ -519,6 +519,7 @@ linker_is_gnu: false, allows_weak_linkage: true, has_rpath: false, @@ -30,7 +30,7 @@ Hacky hacky! no_default_libraries: true, position_independent_executables: false, static_position_independent_executables: false, -@@ -616,6 +616,7 @@ +@@ -776,6 +776,7 @@ key!(linker_is_gnu, bool); key!(allows_weak_linkage, bool); key!(has_rpath, bool); @@ -38,7 +38,7 @@ Hacky hacky! key!(no_default_libraries, bool); key!(position_independent_executables, bool); key!(static_position_independent_executables, bool); -@@ -781,6 +782,7 @@ +@@ -980,6 +980,7 @@ target_option_val!(linker_is_gnu); target_option_val!(allows_weak_linkage); target_option_val!(has_rpath); @@ -48,7 +48,7 @@ Hacky hacky! target_option_val!(static_position_independent_executables); --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs -@@ -901,7 +901,10 @@ +@@ -1092,7 +1092,10 @@ // FIXME (#2397): At some point we want to rpath our guesses as to // where extern libraries might live, based on the // addl_lib_search_paths @@ -58,5 +58,5 @@ Hacky hacky! + if !bootstrap && !sess.crt_static() && + (sess.opts.cg.rpath || sess.target.target.options.need_rpath) { let sysroot = sess.sysroot(); - let target_triple = &sess.opts.target_triple; + let target_triple = sess.opts.target_triple.triple(); let mut get_install_prefix_lib_path = || { diff --git a/community/rust/static-pie.patch b/community/rust/static-pie.patch index daee42f286..542dbffb88 100644 --- a/community/rust/static-pie.patch +++ b/community/rust/static-pie.patch @@ -1,5 +1,5 @@ From: Shiz <hi@shiz.me> -Date: Tue, 11 Apr 2017 04:37:00 +0200 +Last-Updated: Sun, 20 May 2018 00:05:00 +0200 Subject: [PATCH] Add support for static PIE executables Note that static PIE binaries are reported as dynamically linked by file(1): @@ -42,9 +42,9 @@ library, just like static binaries, but more secure. --- 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; +@@ -25,5 +25,8 @@ + // These targets allow the user to choose between static and dynamic linking. + base.crt_static_respected = true; + // Static position-independent executables are supported. + base.static_position_independent_executables = true; @@ -53,7 +53,7 @@ library, just like static binaries, but more secure. } --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs -@@ -350,6 +350,8 @@ +@@ -388,6 +388,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, @@ -62,36 +62,36 @@ library, just like static binaries, but more secure. /// 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 @@ +@@ -519,7 +519,8 @@ has_rpath: false, no_default_libraries: true, position_independent_executables: false, + static_position_independent_executables: false, - relro_level: RelroLevel::Off, + relro_level: RelroLevel::None, 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 @@ +@@ -994,13 +994,9 @@ + let mut position_independent_executable = false; - 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()); + if 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 -- && !sess.crt_static() && !args.any(|x| *x == "-static") { -+ && (!sess.crt_static() || static_pie) { - cmd.position_independent_executable(); ++ let static_pie = t.options.static_position_independent_executables; + if get_reloc_model(sess) == llvm::RelocMode::PIC +- && !sess.crt_static() && !args.any(|x| *x == "-static") { ++ && (!sess.crt_static() || static_pie) { + position_independent_executable = true; + } } - } --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs -@@ -612,7 +612,8 @@ +@@ -778,7 +778,8 @@ key!(has_rpath, bool); key!(no_default_libraries, bool); key!(position_independent_executables, bool); @@ -100,7 +100,7 @@ library, just like static binaries, but more secure. key!(archive_format); key!(allow_asm, bool); key!(custom_unwind_resume, bool); -@@ -776,7 +777,8 @@ +@@ -981,7 +981,8 @@ target_option_val!(has_rpath); target_option_val!(no_default_libraries); target_option_val!(position_independent_executables); |