summaryrefslogtreecommitdiff
path: root/extra/rustc
diff options
context:
space:
mode:
Diffstat (limited to 'extra/rustc')
-rw-r--r--extra/rustc/files/check-rustc109
-rw-r--r--extra/rustc/patches/0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch24
-rw-r--r--extra/rustc/patches/0007-do-not-install-libunwind-source.patch19
-rw-r--r--extra/rustc/patches/alpine-move-py-scripts-to-share.patch23
-rw-r--r--extra/rustc/patches/alpine-target.patch191
-rw-r--r--extra/rustc/patches/install-template-shebang.patch10
-rw-r--r--extra/rustc/patches/link-musl-dynamically.patch17
-rw-r--r--extra/rustc/patches/musl-fix-linux_musl_base.patch23
-rw-r--r--extra/rustc/patches/need-rpath.patch62
-rw-r--r--extra/rustc/patches/need-ssp_nonshared.patch13
10 files changed, 0 insertions, 491 deletions
diff --git a/extra/rustc/files/check-rustc b/extra/rustc/files/check-rustc
deleted file mode 100644
index d4b85be..0000000
--- a/extra/rustc/files/check-rustc
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/bin/sh
-# vim: set ts=4:
-set -eu
-
-RUSTC="$1"
-TMPDIR="$(pwd)/.tmp-${0##*/}-$RANDOM"
-failed=0
-
-unset RUST_BACKTRACE
-unset RUSTC_CRT_STATIC
-
-
-_rustc() {
- printf '\n$ rustc %s\n' "$*"
- "$RUSTC" "$@"
-}
-
-die() {
- printf '\033[1;31mERROR:\033[0m %s\n' "$1" >&2 # bold red
- exit 1
-}
-
-fail() {
- printf '\033[1;31mFAIL:\033[0m %s\n' "$1" >&2 # bold red
- failed=$(( failed + 1 ))
-}
-
-assert_dynamic() {
- readelf -l "$1" | grep -Fqw INTERP \
- && readelf -d "$1" | grep -Fqw NEEDED || {
- fail "$1 is not a dynamic executable!"
- readelf -ld "$1"
- }
-}
-
-assert_ok() {
- "$1" || fail "$1 exited with status $?"
-}
-
-assert_panic() {
- local status=0
- "$1" || status=$? && [ "$status" = 101 ] \
- || fail "$1 exited with status $status, but expected 101"
-}
-
-assert_pie() {
- readelf -d "$1" | grep -Fw FLAGS_1 | grep -Fqw PIE || {
- fail "$1 is not a PIE executable!"
- readelf -d "$1"
- }
-}
-
-assert_static() {
- test -f "$1" \
- && ! readelf -l "$1" | grep -Fqw INTERP \
- && ! readelf -d "$1" | grep -Fqw NEEDED || {
- fail "$1 is not a static executable!"
- readelf -ld "$1"
- }
-}
-
-
-#-------------------- M a i n --------------------
-
-test -d "$TMPDIR" && die "$TMPDIR already exists!"
-mkdir -p "$TMPDIR"
-trap "rm -R '$TMPDIR'" EXIT
-
-cd "$TMPDIR"
-
-cat >> hello_world.rs <<-EOF
- fn main() {
- println!("Hello, world!");
- }
-EOF
-
-_rustc hello_world.rs
-assert_ok ./hello_world
-assert_dynamic hello_world
-assert_pie hello_world
-rm -f hello_world
-
-_rustc -C target-feature=-crt-static hello_world.rs
-assert_ok ./hello_world
-assert_dynamic hello_world
-assert_pie hello_world
-rm -f hello_world
-
-_rustc -C target-feature=+crt-static hello_world.rs
-assert_ok ./hello_world
-assert_static hello_world
-assert_pie hello_world
-rm -f hello_world
-
-
-cat >> panic.rs <<-EOF
- fn main() {
- panic!("This should panic");
- }
-EOF
-
-_rustc -C target-feature=-crt-static panic.rs
-assert_panic ./panic
-
-_rustc -C target-feature=+crt-static panic.rs
-assert_panic ./panic
-
-
-[ "$failed" -eq 0 ] || die "$failed assertion(s) has failed"
diff --git a/extra/rustc/patches/0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch b/extra/rustc/patches/0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
deleted file mode 100644
index 30cb66f..0000000
--- a/extra/rustc/patches/0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Additions for build.rs by q66, necessary for our musl setup.
-
-From 1eb558f246269606c6d8d73824ef6b44fa10764e Mon Sep 17 00:00:00 2001
-From: Samuel Holland <samuel@sholland.org>
-Date: Sat, 9 Sep 2017 00:14:16 -0500
-Subject: [PATCH 06/16] Prefer libgcc_eh over libunwind for musl
-
----
- src/libunwind/lib.rs | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs
-index 9182e349b19..0377fbb58fc 100644
---- a/library/unwind/src/lib.rs
-+++ b/library/unwind/src/lib.rs
-@@ -51,7 +51,7 @@
- #[link(name = "unwind", cfg(not(target_feature = "crt-static")))]
- extern "C" {}
- } else {
-- #[link(name = "unwind", kind = "static", modifiers = "-bundle", cfg(target_feature = "crt-static"))]
-+ #[link(name = "gcc_eh", cfg(target_feature = "crt-static"))]
- #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
- extern "C" {}
- }
diff --git a/extra/rustc/patches/0007-do-not-install-libunwind-source.patch b/extra/rustc/patches/0007-do-not-install-libunwind-source.patch
deleted file mode 100644
index e8ff8b7..0000000
--- a/extra/rustc/patches/0007-do-not-install-libunwind-source.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-From: Dominic Meiser <alpine@msrd0.de>
-Date: Tue, 22 Dec 2020 23:31:28 +0100
-Subject: [PATCH] Do not install libunwind source
-
-This was added in rustc 1.48, but is incompatible with the Alpine Linux package since it removes all bundled
-dependencies prior to building.
-
-diff -Naur rustc-1.48.0-src.orig/src/bootstrap/dist.rs rustc-1.48.0-src/src/bootstrap/dist.rs
---- rustc-1.48.0-src.orig/src/bootstrap/dist.rs 2020-12-22 16:39:30.504249113 +0100
-+++ rustc-1.48.0-src/src/bootstrap/dist.rs 2020-12-22 16:42:08.663006830 +0100
-@@ -1016,7 +1016,7 @@
- copy_src_dirs(
- builder,
- &builder.src,
-- &["library", "src/llvm-project/libunwind"],
-+ &["library"],
- &[
- // not needed and contains symlinks which rustup currently
- // chokes on when unpacking.
diff --git a/extra/rustc/patches/alpine-move-py-scripts-to-share.patch b/extra/rustc/patches/alpine-move-py-scripts-to-share.patch
deleted file mode 100644
index 21be36f..0000000
--- a/extra/rustc/patches/alpine-move-py-scripts-to-share.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/src/etc/rust-gdb
-+++ b/src/etc/rust-gdb
-@@ -12,7 +12,7 @@
-
- # Find out where the pretty printer Python module is
- RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
--GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
-+GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/share/rust/etc"
-
- # Run GDB with the additional arguments that load the pretty printers
- # Set the environment variable `RUST_GDB` to overwrite the call to a
- # Set the environment variable `RUST_GDB` to overwrite the call to a
---- a/src/etc/rust-lldb
-+++ b/src/etc/rust-lldb
-@@ -8,7 +8,7 @@
-
- # Find out where to look for the pretty printer Python module
- RUSTC_SYSROOT=$(rustc --print sysroot)
--RUST_LLDB="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb"
-+RUST_LLDB="$RUSTC_SYSROOT/share/rust/etc"
-
- lldb=lldb
- if [ -f "$RUST_LLDB" ]; then
diff --git a/extra/rustc/patches/alpine-target.patch b/extra/rustc/patches/alpine-target.patch
deleted file mode 100644
index 2392cdd..0000000
--- a/extra/rustc/patches/alpine-target.patch
+++ /dev/null
@@ -1,191 +0,0 @@
-From: Shiz <hi@shiz.me>
-Updated by Rasmus Thomsen <oss@cogitri.dev> on 28th of July 2019
-Updated again by Ariadne Conill <ariadne@dereferenced.org> on 31 October 2020
-Date: Thu, 20 Aug 2017 01:52:36 +0200
-Last-Updated: Sat, 28 Oct 2017 20:23:00 +0200
-Subject: [PATCH] Add Alpine targets
-
-This adds `$arch-alpine-linux-musl` targets to Rust to encode our toolchain
-and distribution-specific quirks instead of polluting the main musl target of
-`$arch-unknown-linux-musl`.
-
---- /dev/null
-+++ rustc-1.48.0-src/compiler/rustc_target/src/spec/aarch64_alpine_linux_musl.rs
-@@ -0,0 +1,13 @@
-+use crate::spec::Target;
-+
-+pub fn target() -> Target {
-+ let mut base = super::aarch64_unknown_linux_musl::target();
-+
-+ base.llvm_target = "aarch64-alpine-linux-musl".to_string();
-+ base.options.vendor = "alpine".to_string();
-+ base.options.crt_static_default = false;
-+ base.options.static_position_independent_executables = true;
-+ base.options.need_rpath = true;
-+
-+ base
-+}
---- /dev/null
-+++ rustc-1.48.0-src/compiler/rustc_target/src/spec/armv6_alpine_linux_musleabihf.rs
-@@ -0,0 +1,13 @@
-+use crate::spec::Target;
-+
-+pub fn target() -> Target {
-+ let mut base = super::arm_unknown_linux_musleabihf::target();
-+
-+ base.llvm_target = "armv6-alpine-linux-musleabihf".to_string();
-+ base.options.vendor = "alpine".to_string();
-+ base.options.crt_static_default = false;
-+ base.options.static_position_independent_executables = true;
-+ base.options.need_rpath = true;
-+
-+ base
-+}
---- /dev/null
-+++ rustc-1.48.0-src/compiler/rustc_target/src/spec/armv7_alpine_linux_musleabihf.rs
-@@ -0,0 +1,13 @@
-+use crate::spec::Target;
-+
-+pub fn target() -> Target {
-+ let mut base = super::armv7_unknown_linux_musleabihf::target();
-+
-+ base.llvm_target = "armv7-alpine-linux-musleabihf".to_string();
-+ base.options.vendor = "alpine".to_string();
-+ base.options.crt_static_default = false;
-+ base.options.static_position_independent_executables = true;
-+ base.options.need_rpath = true;
-+
-+ base
-+}
---- /dev/null
-+++ rustc-1.48.0-src/compiler/rustc_target/src/spec/i586_alpine_linux_musl.rs
-@@ -0,0 +1,14 @@
-+use crate::spec::Target;
-+
-+pub fn target() -> Target {
-+ let mut base = super::i686_unknown_linux_musl::target();
-+
-+ base.options.cpu = "pentium4".to_string();
-+ base.llvm_target = "i586-alpine-linux-musl".to_string();
-+ base.options.vendor = "alpine".to_string();
-+ base.options.crt_static_default = false;
-+ base.options.static_position_independent_executables = true;
-+ base.options.need_rpath = true;
-+
-+ base
-+}
---- rustc-1.48.0-src.orig/compiler/rustc_target/src/spec/mod.rs
-+++ rustc-1.48.0-src/compiler/rustc_target/src/spec/mod.rs
-@@ -490,6 +490,16 @@
- }
-
- supported_targets! {
-+ ("i586-alpine-linux-musl", i586_alpine_linux_musl),
-+ ("x86_64-alpine-linux-musl", x86_64_alpine_linux_musl),
-+ ("aarch64-alpine-linux-musl", aarch64_alpine_linux_musl),
-+ ("armv6-alpine-linux-musleabihf", armv6_alpine_linux_musleabihf),
-+ ("armv7-alpine-linux-musleabihf", armv7_alpine_linux_musleabihf),
-+ ("powerpc-alpine-linux-musl", powerpc_alpine_linux_musl),
-+ ("powerpc64-alpine-linux-musl", powerpc64_alpine_linux_musl),
-+ ("powerpc64le-alpine-linux-musl", powerpc64le_alpine_linux_musl),
-+ ("s390x-alpine-linux-musl", s390x_alpine_linux_musl),
-+ ("riscv64-alpine-linux-musl", riscv64_alpine_linux_musl),
- ("x86_64-unknown-linux-gnu", x86_64_unknown_linux_gnu),
- ("x86_64-unknown-linux-gnux32", x86_64_unknown_linux_gnux32),
- ("i686-unknown-linux-gnu", i686_unknown_linux_gnu),
---- /dev/null
-+++ rustc-1.48.0-src/compiler/rustc_target/src/spec/powerpc64_alpine_linux_musl.rs
-@@ -0,0 +1,13 @@
-+use crate::spec::Target;
-+
-+pub fn target() -> Target {
-+ let mut base = super::powerpc64_unknown_linux_musl::target();
-+
-+ base.llvm_target = "powerpc64-alpine-linux-musl".to_string();
-+ base.options.vendor = "alpine".to_string();
-+ base.options.crt_static_default = false;
-+ base.options.static_position_independent_executables = true;
-+ base.options.need_rpath = true;
-+
-+ base
-+}
---- /dev/null
-+++ rustc-1.48.0-src/compiler/rustc_target/src/spec/powerpc64le_alpine_linux_musl.rs
-@@ -0,0 +1,13 @@
-+use crate::spec::Target;
-+
-+pub fn target() -> Target {
-+ let mut base = super::powerpc64le_unknown_linux_musl::target();
-+
-+ base.llvm_target = "powerpc64le-alpine-linux-musl".to_string();
-+ base.options.vendor = "alpine".to_string();
-+ base.options.crt_static_default = false;
-+ base.options.static_position_independent_executables = true;
-+ base.options.need_rpath = true;
-+
-+ base
-+}
---- /dev/null
-+++ rustc-1.48.0-src/compiler/rustc_target/src/spec/powerpc_alpine_linux_musl.rs
-@@ -0,0 +1,13 @@
-+use crate::spec::Target;
-+
-+pub fn target() -> Target {
-+ let mut base = super::powerpc_unknown_linux_musl::target();
-+
-+ base.llvm_target = "powerpc-alpine-linux-musl".to_string();
-+ base.options.vendor = "alpine".to_string();
-+ base.options.crt_static_default = false;
-+ base.options.static_position_independent_executables = true;
-+ base.options.need_rpath = true;
-+
-+ base
-+}
---- /dev/null
-+++ rustc-1.48.0-src/compiler/rustc_target/src/spec/s390x_alpine_linux_musl.rs
-@@ -0,0 +1,13 @@
-+use crate::spec::Target;
-+
-+pub fn target() -> Target {
-+ let mut base = super::s390x_unknown_linux_musl::target();
-+
-+ base.llvm_target = "s390x-alpine-linux-musl".to_string();
-+ base.options.vendor = "alpine".to_string();
-+ base.options.crt_static_default = false;
-+ base.options.static_position_independent_executables = true;
-+ base.options.need_rpath = true;
-+
-+ base
-+}
---- /dev/null
-+++ rustc-1.48.0-src/compiler/rustc_target/src/spec/x86_64_alpine_linux_musl.rs
-@@ -0,0 +1,13 @@
-+use crate::spec::Target;
-+
-+pub fn target() -> Target {
-+ let mut base = super::x86_64_unknown_linux_musl::target();
-+
-+ base.llvm_target = "x86_64-alpine-linux-musl".to_string();
-+ base.options.vendor = "alpine".to_string();
-+ base.options.crt_static_default = false;
-+ base.options.static_position_independent_executables = true;
-+ base.options.need_rpath = true;
-+
-+ base
-+}
---- /dev/null
-+++ rustc-1.52.1-src/compiler/rustc_target/src/spec/riscv64_alpine_linux_musl.rs
-@@ -0,0 +1,13 @@
-+use crate::spec::Target;
-+
-+pub fn target() -> Target {
-+ let mut base = super::riscv64gc_unknown_linux_musl::target();
-+
-+ base.llvm_target = "riscv64-alpine-linux-musl".to_string();
-+ base.options.vendor = "alpine".to_string();
-+ base.options.crt_static_default = false;
-+ base.options.static_position_independent_executables = true;
-+ base.options.need_rpath = true;
-+
-+ base
-+}
diff --git a/extra/rustc/patches/install-template-shebang.patch b/extra/rustc/patches/install-template-shebang.patch
deleted file mode 100644
index e81b579..0000000
--- a/extra/rustc/patches/install-template-shebang.patch
+++ /dev/null
@@ -1,10 +0,0 @@
-The script seems to be POSIX-sh (+ local) compatible.
-
---- a/src/tools/rust-installer/install-template.sh
-+++ b/src/tools/rust-installer/install-template.sh
-@@ -1,4 +1,4 @@
--#!/bin/bash
-+#!/bin/sh
- # Copyright 2014 The Rust Project Developers. See the COPYRIGHT
- # file at the top-level directory of this distribution and at
- # http://rust-lang.org/COPYRIGHT.
diff --git a/extra/rustc/patches/link-musl-dynamically.patch b/extra/rustc/patches/link-musl-dynamically.patch
deleted file mode 100644
index 55d02a3..0000000
--- a/extra/rustc/patches/link-musl-dynamically.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- rustc-1.58.0-src.orig/vendor/libc/src/unix/mod.rs
-+++ rustc-1.58.0-src/vendor/libc/src/unix/mod.rs
-@@ -329,11 +329,11 @@
- #[link(name = "c", cfg(not(target_feature = "crt-static")))]
- extern {}
- } else if #[cfg(target_env = "musl")] {
-+ #[link(name = "c")]
-+ extern {}
- #[cfg_attr(feature = "rustc-dep-of-std",
-- link(name = "c", kind = "static", modifiers = "-bundle",
-+ link(name = "gcc", kind = "static", modifiers = "-bundle",
- cfg(target_feature = "crt-static")))]
-- #[cfg_attr(feature = "rustc-dep-of-std",
-- link(name = "c", cfg(not(target_feature = "crt-static"))))]
- extern {}
- } else if #[cfg(target_os = "emscripten")] {
- #[link(name = "c")]
diff --git a/extra/rustc/patches/musl-fix-linux_musl_base.patch b/extra/rustc/patches/musl-fix-linux_musl_base.patch
deleted file mode 100644
index 1771ffe..0000000
--- a/extra/rustc/patches/musl-fix-linux_musl_base.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: Jakub Jirutka <jakub@jirutka.cz>
-Date: Sat, 08 Aug 2016 15:06:00 +0200
-Subject: [PATCH] Fix linux_musl_base for native musl host
-
-See https://github.com/rust-lang/rust/pull/40113
-
---- a/compiler/rustc_target/src/spec/linux_musl_base.rs
-+++ b/compiler/rustc_target/src/spec/linux_musl_base.rs
-@@ -5,12 +5,9 @@
- let mut base = super::linux_base::opts();
-
- base.env = "musl".to_string();
-- base.pre_link_objects_fallback = crt_objects::pre_musl_fallback();
-- base.post_link_objects_fallback = crt_objects::post_musl_fallback();
-- base.crt_objects_fallback = Some(CrtObjectsFallback::Musl);
-
- // These targets statically link libc by default
-- base.crt_static_default = true;
-+ base.crt_static_default = false;
-
- base
- }
-
diff --git a/extra/rustc/patches/need-rpath.patch b/extra/rustc/patches/need-rpath.patch
deleted file mode 100644
index 5ab8377..0000000
--- a/extra/rustc/patches/need-rpath.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-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/compiler/rustc_target/src/spec/mod.rs
-+++ b/compiler/rustc_target/src/spec/mod.rs
-@@ -379,6 +379,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,
-@@ -519,6 +519,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,
-@@ -776,6 +776,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);
-@@ -980,6 +980,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/compiler/rustc_codegen_ssa/src/back/link.rs.orig
-+++ b/compiler/rustc_codegen_ssa/src/back/link.rs
-@@ -1675,7 +1675,10 @@
- // FIXME (#2397): At some point we want to rpath our guesses as to
- // where extern libraries might live, based on the
- // add_lib_search_paths
-- if sess.opts.cg.rpath {
-+ // XXX: hacky hacky
-+ let bootstrap = env::var("RUSTC_BOOTSTRAP").is_ok();
-+ if !bootstrap && !sess.crt_static(None) &&
-+ (sess.opts.cg.rpath || sess.target.options.need_rpath) {
- let libs = codegen_results
- .crate_info
- .used_crates
diff --git a/extra/rustc/patches/need-ssp_nonshared.patch b/extra/rustc/patches/need-ssp_nonshared.patch
deleted file mode 100644
index f1adf20..0000000
--- a/extra/rustc/patches/need-ssp_nonshared.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/library/std/src/sys/unix/mod.rs.orig 2021-02-11 18:34:14.479832268 +0100
-+++ b/library/std/src/sys/unix/mod.rs 2021-02-11 18:38:28.078987749 +0100
-@@ -243,6 +243,9 @@
- #[link(name = "log")]
- #[link(name = "gcc")]
- extern "C" {}
-+ } else if #[cfg(all(target_os = "linux", target_env = "musl"))] {
-+ #[link(name = "ssp_nonshared")]
-+ extern "C" {}
- } else if #[cfg(target_os = "freebsd")] {
- #[link(name = "execinfo")]
- #[link(name = "pthread")]
-