aboutsummaryrefslogtreecommitdiffstats
path: root/community/rust/need-rpath.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 /community/rust/need-rpath.patch
parentabfa07f26ff2837922903586b15e137b67b43219 (diff)
downloadaports-41489596392977197d046ca034685664a3f4afa4.tar.bz2
aports-41489596392977197d046ca034685664a3f4afa4.tar.xz
community/rust: move from testing
Diffstat (limited to 'community/rust/need-rpath.patch')
-rw-r--r--community/rust/need-rpath.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/community/rust/need-rpath.patch b/community/rust/need-rpath.patch
new file mode 100644
index 0000000000..b345d27d92
--- /dev/null
+++ b/community/rust/need-rpath.patch
@@ -0,0 +1,62 @@
+From: Shiz <hi@shiz.me>
+Date: Thu, 20 Aug 2017 01:48:22 +0200
+Subject: [PATCH] Add need_rpath target option to force RPATH generation
+
+This adds a `need_rpath` option to the target options in order to implicitly
+have the equivalent of `-C rpath` specified by default for final products
+(executables and dynamic libraries), so that RPATHs are always added.
+
+We have to skip this step in the bootstrap phase as it does its own manual
+RPATH additions, but unfortunately there's no clean way to detect this.
+As such, we have to resort to checking the `RUSTC_BOOTSTRAP` variable.
+Hacky hacky!
+
+--- a/src/librustc_back/target/mod.rs
++++ b/src/librustc_back/target/mod.rs
+@@ -341,6 +341,8 @@
+ pub allows_weak_linkage: bool,
+ /// Whether the linker support rpaths or not. Defaults to false.
+ pub has_rpath: bool,
++ /// Whether to force rpath support on by default. Defaults to false.
++ pub need_rpath: bool,
+ /// Whether to disable linking to the default libraries, typically corresponds
+ /// to `-nodefaultlibs`. Defaults to true.
+ pub no_default_libraries: bool,
+@@ -434,6 +436,7 @@
+ linker_is_gnu: false,
+ allows_weak_linkage: true,
+ has_rpath: false,
++ need_rpath: false,
+ no_default_libraries: true,
+ position_independent_executables: false,
+ static_position_independent_executables: false,
+@@ -616,6 +616,7 @@
+ key!(linker_is_gnu, bool);
+ key!(allows_weak_linkage, bool);
+ key!(has_rpath, bool);
++ key!(need_rpath, bool);
+ key!(no_default_libraries, bool);
+ key!(position_independent_executables, bool);
+ key!(static_position_independent_executables, bool);
+@@ -781,6 +782,7 @@
+ target_option_val!(linker_is_gnu);
+ target_option_val!(allows_weak_linkage);
+ target_option_val!(has_rpath);
++ target_option_val!(need_rpath);
+ target_option_val!(no_default_libraries);
+ target_option_val!(position_independent_executables);
+ 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 @@
+ // 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
+- if sess.opts.cg.rpath {
++ // XXX: hacky hacky
++ let bootstrap = env::var("RUSTC_BOOTSTRAP").is_ok();
++ if !bootstrap && !sess.fully_static() &&
++ (sess.opts.cg.rpath || sess.target.target.options.need_rpath) {
+ let sysroot = sess.sysroot();
+ let target_triple = &sess.opts.target_triple;
+ let mut get_install_prefix_lib_path = || {