Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dynamically-linked musl targets #82556

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/aarch64_unknown_linux_dynmusl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::aarch64_unknown_linux_musl::target();

base.llvm_target = "aarch64-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/arm_unknown_linux_dynmusleabihf.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::arm_unknown_linux_musleabihf::target();

base.llvm_target = "armv6-unknown-linux-musleabihf".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::armv7_unknown_linux_musleabihf::target();

base.llvm_target = "armv7-unknown-linux-musleabihf".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
kaniini marked this conversation as resolved.
Show resolved Hide resolved
}
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/i586_unknown_linux_dynmusl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::i586_unknown_linux_musl::target();

base.llvm_target = "i586-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/i686_unknown_linux_dynmusl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::i686_unknown_linux_musl::target();

base.llvm_target = "i686-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::mips64_unknown_linux_muslabi64::target();

base.llvm_target = "mips64-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::mips64el_unknown_linux_muslabi64::target();

base.llvm_target = "mips64el-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/mips_unknown_linux_dynmusl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::mips_unknown_linux_musl::target();

base.llvm_target = "mips-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/mipsel_unknown_linux_dynmusl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::mipsel_unknown_linux_musl::target();

base.llvm_target = "mipsel-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,28 +626,35 @@ supported_targets! {
("i686-unknown-linux-gnu", i686_unknown_linux_gnu),
("i586-unknown-linux-gnu", i586_unknown_linux_gnu),
("mips-unknown-linux-gnu", mips_unknown_linux_gnu),
("mips-unknown-linux-dynmusl", mips_unknown_linux_dynmusl),
("mips64-unknown-linux-gnuabi64", mips64_unknown_linux_gnuabi64),
("mips64el-unknown-linux-gnuabi64", mips64el_unknown_linux_gnuabi64),
("mipsisa32r6-unknown-linux-gnu", mipsisa32r6_unknown_linux_gnu),
("mipsisa32r6el-unknown-linux-gnu", mipsisa32r6el_unknown_linux_gnu),
("mipsisa64r6-unknown-linux-gnuabi64", mipsisa64r6_unknown_linux_gnuabi64),
("mipsisa64r6el-unknown-linux-gnuabi64", mipsisa64r6el_unknown_linux_gnuabi64),
("mipsel-unknown-linux-gnu", mipsel_unknown_linux_gnu),
("mipsel-unknown-linux-dynmusl", mipsel_unknown_linux_dynmusl),
("powerpc-unknown-linux-gnu", powerpc_unknown_linux_gnu),
("powerpc-unknown-linux-gnuspe", powerpc_unknown_linux_gnuspe),
("powerpc-unknown-linux-musl", powerpc_unknown_linux_musl),
("powerpc-unknown-linux-dynmusl", powerpc_unknown_linux_dynmusl),
("powerpc64-unknown-linux-gnu", powerpc64_unknown_linux_gnu),
("powerpc64-unknown-linux-musl", powerpc64_unknown_linux_musl),
("powerpc64-unknown-linux-dynmusl", powerpc64_unknown_linux_dynmusl),
("powerpc64le-unknown-linux-gnu", powerpc64le_unknown_linux_gnu),
("powerpc64le-unknown-linux-musl", powerpc64le_unknown_linux_musl),
("powerpc64le-unknown-linux-dynmusl", powerpc64le_unknown_linux_dynmusl),
("s390x-unknown-linux-gnu", s390x_unknown_linux_gnu),
("s390x-unknown-linux-musl", s390x_unknown_linux_musl),
("s390x-unknown-linux-dynmusl", s390x_unknown_linux_dynmusl),
("sparc-unknown-linux-gnu", sparc_unknown_linux_gnu),
("sparc64-unknown-linux-gnu", sparc64_unknown_linux_gnu),
("arm-unknown-linux-gnueabi", arm_unknown_linux_gnueabi),
("arm-unknown-linux-gnueabihf", arm_unknown_linux_gnueabihf),
("arm-unknown-linux-musleabi", arm_unknown_linux_musleabi),
("arm-unknown-linux-musleabihf", arm_unknown_linux_musleabihf),
("arm-unknown-linux-dynmusleabihf", arm_unknown_linux_dynmusleabihf),
("armv4t-unknown-linux-gnueabi", armv4t_unknown_linux_gnueabi),
("armv5te-unknown-linux-gnueabi", armv5te_unknown_linux_gnueabi),
("armv5te-unknown-linux-musleabi", armv5te_unknown_linux_musleabi),
Expand All @@ -658,15 +665,22 @@ supported_targets! {
("thumbv7neon-unknown-linux-musleabihf", thumbv7neon_unknown_linux_musleabihf),
("armv7-unknown-linux-musleabi", armv7_unknown_linux_musleabi),
("armv7-unknown-linux-musleabihf", armv7_unknown_linux_musleabihf),
("armv7-unknown-linux-dynmusleabihf", armv7_unknown_linux_dynmusleabihf),
("aarch64-unknown-linux-gnu", aarch64_unknown_linux_gnu),
("aarch64-unknown-linux-musl", aarch64_unknown_linux_musl),
("aarch64-unknown-linux-dynmusl", aarch64_unknown_linux_dynmusl),
("x86_64-unknown-linux-musl", x86_64_unknown_linux_musl),
("x86_64-unknown-linux-dynmusl", x86_64_unknown_linux_dynmusl),
("i686-unknown-linux-musl", i686_unknown_linux_musl),
("i686-unknown-linux-dynmusl", i686_unknown_linux_dynmusl),
("i586-unknown-linux-musl", i586_unknown_linux_musl),
("i586-unknown-linux-dynmusl", i586_unknown_linux_dynmusl),
("mips-unknown-linux-musl", mips_unknown_linux_musl),
("mipsel-unknown-linux-musl", mipsel_unknown_linux_musl),
("mips64-unknown-linux-muslabi64", mips64_unknown_linux_muslabi64),
("mips64-unknown-linux-dynmuslabi64", mips64_unknown_linux_dynmuslabi64),
("mips64el-unknown-linux-muslabi64", mips64el_unknown_linux_muslabi64),
("mips64el-unknown-linux-dynmuslabi64", mips64el_unknown_linux_dynmuslabi64),
("hexagon-unknown-linux-musl", hexagon_unknown_linux_musl),

("mips-unknown-linux-uclibc", mips_unknown_linux_uclibc),
Expand Down
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/powerpc64_unknown_linux_dynmusl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::powerpc64_unknown_linux_musl::target();

base.llvm_target = "powerpc64-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::powerpc64le_unknown_linux_musl::target();

base.llvm_target = "powerpc64le-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/powerpc_unknown_linux_dynmusl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::powerpc_unknown_linux_musl::target();

base.llvm_target = "powerpc-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/s390x_unknown_linux_dynmusl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::s390x_unknown_linux_musl::target();

base.llvm_target = "s390x-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
14 changes: 14 additions & 0 deletions compiler/rustc_target/src/spec/x86_64_unknown_linux_dynmusl.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use crate::spec::crt_objects::new;
use crate::spec::Target;

pub fn target() -> Target {
let mut base = super::x86_64_unknown_linux_musl::target();

base.llvm_target = "x86_64-unknown-linux-musl".to_string();
base.options.crt_static_default = false;
base.options.pre_link_objects_fallback = new(&[]);
base.options.post_link_objects_fallback = new(&[]);
base.options.crt_objects_fallback = None;

base
}
2 changes: 1 addition & 1 deletion src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ fn copy_self_contained_objects(
// to using gcc from a glibc-targeting toolchain for linking.
// To do that we have to distribute musl startup objects as a part of Rust toolchain
// and link with them manually in the self-contained mode.
if target.contains("musl") {
if target.contains("-musl") {
let srcdir = builder.musl_libdir(target).unwrap();
for &obj in &["crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] {
copy_and_stamp(
Expand Down
Loading