aboutsummaryrefslogtreecommitdiffstats
path: root/testing/rust/alpine-force-rpath-on-prefer-dynamic.patch
diff options
context:
space:
mode:
authorShiz <hi@shiz.me>2017-04-16 15:56:18 +0000
committerJakub Jirutka <jakub@jirutka.cz>2017-04-21 01:44:33 +0200
commit3db351aa5647eb4a482e9e008bedcf1a5be51302 (patch)
treefe64ea58b55936fc2da3f78eaa48c1703ec6bcf6 /testing/rust/alpine-force-rpath-on-prefer-dynamic.patch
parente4cc4b79b548e043d635ff35c3e9f2e832be1202 (diff)
downloadaports-3db351aa5647eb4a482e9e008bedcf1a5be51302.tar.bz2
aports-3db351aa5647eb4a482e9e008bedcf1a5be51302.tar.xz
testing/rust: reorganize patches
This divides up the patches in three logical categories: - musl-*.patch: musl support patches intended for upstreaming; - alpine-*.patch: Alpine-specific patches that are likely not upstreamable; - *.patch: functionality patch that may make it upstream.
Diffstat (limited to 'testing/rust/alpine-force-rpath-on-prefer-dynamic.patch')
-rw-r--r--testing/rust/alpine-force-rpath-on-prefer-dynamic.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/testing/rust/alpine-force-rpath-on-prefer-dynamic.patch b/testing/rust/alpine-force-rpath-on-prefer-dynamic.patch
new file mode 100644
index 0000000000..3c3aced9bd
--- /dev/null
+++ b/testing/rust/alpine-force-rpath-on-prefer-dynamic.patch
@@ -0,0 +1,36 @@
+From: Shiz <hi@shiz.me>
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Wed, 12 Apr 2017 23:28:09 +0200
+Subject: [PATCH] Force rpath on prefer-dynamic
+
+When you build a dynamic binary with `-C prefer-dynamic`, rustc links
+dynamically even Rust libraries, built as shared objects. These are
+installed in /usr/lib/rustlib/<TARGET>/lib/, the location that is not
+on standard LD path, at least on Alpine.
+
+Therefore such binary would be unusable when not built with `-C rpath`
+(or manually specifying LD_LIBRARY_PATH). For that reason we implicitly
+enable rpath when `prefer-dynamic` is enabled.
+
+Also note that Rust normally installs identical copy of *.so files from
+/usr/lib/rustlib/<TARGET>/lib/, where <TARGET> equals host triple, to
+/usr/lib. That's why such fully dynamic binary may work on other
+systems even without rpath or having rustlib on the LD path. However,
+since these *.so libraries don't keep stable ABI, they should not be on
+LD path, and thus we do not install them here (see
+change-rpath-to-rustlib.patch).
+
+--- a/src/librustc/session/config.rs
++++ b/src/librustc/session/config.rs
+@@ -1368,6 +1368,11 @@
+
+ let mut cg = build_codegen_options(matches, error_format);
+
++ // Force rpath addition on prefer-dynamic output.
++ if cg.prefer_dynamic {
++ cg.rpath = true;
++ }
++
+ // Issue #30063: if user requests llvm-related output to one
+ // particular path, disable codegen-units.
+ if matches.opt_present("o") && cg.codegen_units != 1 {