commit 8041a2aa35b48bc850033ad4e114e93e09ecfd54 Author: Brandon Bergren Date: Sat Apr 24 13:22:37 2021 -0500 Allow bootstrapping rust for powerpc. We are only targeting FreeBSD 13 and above, since the llvm toolchain only supports secure-plt properly on powerpc. diff --git a/lang/rust-bootstrap/Makefile b/lang/rust-bootstrap/Makefile index 4fe3721243c1..784f8f141dfe 100644 --- a/lang/rust-bootstrap/Makefile +++ b/lang/rust-bootstrap/Makefile @@ -31,7 +31,7 @@ BUILD_DEPENDS= cmake:devel/cmake \ gmake:devel/gmake \ rust>=${PORTVERSION}:lang/rust -FLAVORS= aarch64 amd64 armv6 armv7 i386 powerpc64_elfv1 powerpc64_elfv2 powerpc64le +FLAVORS= aarch64 amd64 armv6 armv7 i386 powerpc64_elfv1 powerpc64_elfv2 powerpc64le powerpc FLAVOR?= ${FLAVORS:[1]} aarch64_PKGNAMEPREFIX= aarch64- @@ -40,6 +40,7 @@ amd64_PKGNAMEPREFIX= amd64- armv6_PKGNAMEPREFIX= armv6- armv7_PKGNAMEPREFIX= armv7- i386_PKGNAMEPREFIX= i386- +powerpc_PKGNAMEPREFIX= powerpc- powerpc64_elfv1_PKGNAMEPREFIX= powerpc64-elfv1- powerpc64_elfv1_BUILD_DEPENDS= powerpc64-gcc9>0:devel/freebsd-gcc9@powerpc64 powerpc64_elfv2_PKGNAMEPREFIX= powerpc64-elfv2- @@ -66,6 +67,7 @@ _RUST_FBSD_DIST_amd64= FreeBSD-${_RUST_FBSD_VER}-amd64${EXTRACT_SUFX}:base _RUST_FBSD_DIST_armv6= FreeBSD-${_RUST_FBSD_VER}-arm-armv6${EXTRACT_SUFX}:armbase _RUST_FBSD_DIST_armv7= FreeBSD-${_RUST_FBSD_VER}-arm-armv7${EXTRACT_SUFX}:armbase _RUST_FBSD_DIST_i386= FreeBSD-${_RUST_FBSD_VER}-i386${EXTRACT_SUFX}:base +_RUST_FBSD_DIST_powerpc= FreeBSD-${_RUST_FBSD_VER}-powerpc${EXTRACT_SUFX}:base _RUST_FBSD_DIST_powerpc64_elfv1= FreeBSD-${_RUST_FBSD_VER}-powerpc64-elfv1${EXTRACT_SUFX}:base \ FreeBSD-${_RUST_FBSD_VER}-powerpc64-elfv1-gcc9-9.3.0${EXTRACT_SUFX}:powerpc64_gcc _RUST_FBSD_DIST_powerpc64_elfv2= FreeBSD-${_RUST_FBSD_VER}-powerpc64-elfv2-v1300123${EXTRACT_SUFX}:base @@ -73,12 +75,14 @@ _RUST_FBSD_DIST_powerpc64le= FreeBSD-${_RUST_FBSD_VER}-powerpc64le-r366300${EXT _RUST_FBSD_VER= ${_RUST_FBSD_VER_${FLAVOR}:U11.4-RELEASE} _RUST_FBSD_VER_aarch64= 12.2-RELEASE _RUST_FBSD_VER_armv7= 12.2-RELEASE +_RUST_FBSD_VER_powerpc= 13.0-RELEASE _RUST_FBSD_VER_powerpc64_elfv1= 12.2-RELEASE _RUST_FBSD_VER_powerpc64_elfv2= 13.0-CURRENT _RUST_FBSD_VER_powerpc64le= 13.0-CURRENT _RUST_FBSD_SUBDIR_aarch64= releases/arm64/${_RUST_FBSD_VER}/base.txz?dummy= _RUST_FBSD_SUBDIR_amd64= releases/amd64/${_RUST_FBSD_VER}/base.txz?dummy= _RUST_FBSD_SUBDIR_i386= releases/i386/${_RUST_FBSD_VER}/base.txz?dummy= +_RUST_FBSD_SUBDIR_powerpc= releases/powerpc/powerpc/${_RUST_FBSD_VER}/base.txz?dummy= _RUST_FBSD_SUBDIR_powerpc64_elfv1= releases/powerpc/powerpc64/${_RUST_FBSD_VER}/base.txz?dummy= _RUST_FBSD_SUBDIR_powerpc64_elfv2= snapshots/powerpc/powerpc64/${_RUST_FBSD_VER}/base.txz?dummy= _RUST_FBSD_SUBDIR_powerpc64le= snapshots/powerpc/powerpc64le/${_RUST_FBSD_VER}/base.txz?dummy= @@ -86,6 +90,7 @@ _RUST_FBSD_SUBDIR_powerpc64le= snapshots/powerpc/powerpc64le/${_RUST_FBSD_VER}/ _CARGO_VENDOR_DIR= ${WRKSRC}/vendor _RUST_ARCH_amd64= x86_64 _RUST_ARCH_i386= i686 +_RUST_ARCH_powerpc= powerpc _RUST_ARCH_powerpc64_elfv1= powerpc64 _RUST_ARCH_powerpc64_elfv2= powerpc64 _RUST_ARCH_powerpc64le= powerpc64le @@ -97,12 +102,15 @@ _RUST_LLVM_TARGET_amd64= X86 _RUST_LLVM_TARGET_armv6= ARM _RUST_LLVM_TARGET_armv7= ARM _RUST_LLVM_TARGET_i386= X86 +_RUST_LLVM_TARGET_powerpc= PowerPC _RUST_LLVM_TARGET_powerpc64_elfv1= PowerPC _RUST_LLVM_TARGET_powerpc64_elfv2= PowerPC _RUST_LLVM_TARGET_powerpc64le= PowerPC _RUST_LLVM_TRIPLE= ${_RUST_LLVM_TRIPLE_${FLAVOR}:U${_RUST_TARGET}} _RUST_LLVM_TRIPLE_armv6= armv6-gnueabihf-freebsd _RUST_LLVM_TRIPLE_armv7= armv7-gnueabihf-freebsd +# Specify version to enforce secure-plt. +_RUST_LLVM_TRIPLE_powerpc= powerpc-unknown-freebsd13.0 .include diff --git a/lang/rust-bootstrap/distinfo b/lang/rust-bootstrap/distinfo index 8bfcb64b4e5c..f2d42c3a00a4 100644 --- a/lang/rust-bootstrap/distinfo +++ b/lang/rust-bootstrap/distinfo @@ -11,6 +11,8 @@ SHA256 (FreeBSD-12.2-RELEASE-arm-armv7.tar.xz) = b56bfaf0e9994723b2bb8c36b268ea1 SIZE (FreeBSD-12.2-RELEASE-arm-armv7.tar.xz) = 70116512 SHA256 (FreeBSD-11.4-RELEASE-i386.tar.xz) = ae602552ff4c26f31b304e4a1ffc066db826e75d07ba9a4bf33649e9549bf27b SIZE (FreeBSD-11.4-RELEASE-i386.tar.xz) = 110296208 +SHA256 (FreeBSD-13.0-RELEASE-powerpc.tar.xz) = 8d980deacf7db15775445d00ce49b56a2a8eb519994052a92d2c6a40985910ab +SIZE (FreeBSD-13.0-RELEASE-powerpc.tar.xz) = 146274724 SHA256 (FreeBSD-12.2-RELEASE-powerpc64-elfv1.tar.xz) = 762ec55a9bd40dc93231e24f2df53c58d90b7cef63892b2740a59f9e8f40898e SIZE (FreeBSD-12.2-RELEASE-powerpc64-elfv1.tar.xz) = 109121900 SHA256 (FreeBSD-12.2-RELEASE-powerpc64-elfv1-gcc9-9.3.0.tar.xz) = b1bd46b347e0ef55e8868537aaefe323622adf6fa081bef9ca5f24fc711d40ea diff --git a/lang/rust/Makefile b/lang/rust/Makefile index f7ad497453a1..cf07e67dc3ec 100644 --- a/lang/rust/Makefile +++ b/lang/rust/Makefile @@ -8,6 +8,7 @@ MASTER_SITES= https://static.rust-lang.org/dist/:src \ https://dev-static.rust-lang.org/dist/:src \ LOCAL/tobik/rust:bootstrap \ LOCAL/mikael/rust:bootstrap \ + LOCAL/bdragon/rust:bootstrap \ https://static.rust-lang.org/dist/:bootstrap DISTNAME?= ${PORTNAME}c-${PORTVERSION}-src DISTFILES?= ${NIGHTLY_DATE:D${NIGHTLY_DATE}/}${DISTNAME}${EXTRACT_SUFX}:src \ @@ -25,7 +26,9 @@ LICENSE_FILE_APACHE20= ${WRKSRC}/LICENSE-APACHE LICENSE_FILE_MIT= ${WRKSRC}/LICENSE-MIT IGNORE_FreeBSD_11_powerpc64= is missing a bootstrap for FreeBSD 11.x powerpc64 -ONLY_FOR_ARCHS?= aarch64 amd64 armv6 armv7 i386 powerpc64 powerpc64le +IGNORE_FreeBSD_11_powerpc= is missing a bootstrap for FreeBSD 11.x powerpc +IGNORE_FreeBSD_12_powerpc= is missing a bootstrap for FreeBSD 12.x powerpc +ONLY_FOR_ARCHS?= aarch64 amd64 armv6 armv7 i386 powerpc64 powerpc64le powerpc ONLY_FOR_ARCHS_REASON?= requires prebuilt bootstrap compiler BUILD_DEPENDS= cmake:devel/cmake @@ -60,6 +63,9 @@ WASM_VARS_OFF= _RUST_BUILD_WASM=false BOOTSTRAPS_DATE?= 2021-02-11 RUST_BOOTSTRAP_VERSION?= 1.50.0 +# Initial powerpc bootstrap, remove after 1.51.0 bootstrap build. +RUST_BOOTSTRAP_VERSION_powerpc= 1.51.0 + BOOTSTRAPS_SUFFIX?= ${BOOTSTRAPS_SUFFIX_${ARCH}} BOOTSTRAPS_SUFFIX_powerpc64?= -${PPC_ABI:tl} diff --git a/lang/rust/distinfo b/lang/rust/distinfo index 27c6adc6c978..f86200d3cd80 100644 --- a/lang/rust/distinfo +++ b/lang/rust/distinfo @@ -1,4 +1,4 @@ -TIMESTAMP = 1616749421 +TIMESTAMP = 1619303610 SHA256 (rust/rustc-1.51.0-src.tar.xz) = 92c68a91fca33cbafb83442cde722d010cc387dc1ee8a2680e2fb33a575821a1 SIZE (rust/rustc-1.51.0-src.tar.xz) = 109596164 SHA256 (rust/2021-02-11/rustc-1.50.0-aarch64-unknown-freebsd.tar.xz) = 35861e14be840d59465c3958d7bf56960be362f593f14f440329504d29bdc0e0 @@ -31,6 +31,12 @@ SHA256 (rust/2021-02-11/rust-std-1.50.0-i686-unknown-freebsd.tar.xz) = d59650dea SIZE (rust/2021-02-11/rust-std-1.50.0-i686-unknown-freebsd.tar.xz) = 21622960 SHA256 (rust/2021-02-11/cargo-1.50.0-i686-unknown-freebsd.tar.xz) = 7b07204894a3c5c1f4b39e03c475d8a5ea523a30721af19ba49211c8f46e0cf4 SIZE (rust/2021-02-11/cargo-1.50.0-i686-unknown-freebsd.tar.xz) = 5145204 +SHA256 (rust/2021-02-11/rustc-1.51.0-powerpc-unknown-freebsd.tar.xz) = 89b5155d16f6d3479d46e52c6931ce952331d9efcc0e9e5d995e12fc7f842d37 +SIZE (rust/2021-02-11/rustc-1.51.0-powerpc-unknown-freebsd.tar.xz) = 47793452 +SHA256 (rust/2021-02-11/rust-std-1.51.0-powerpc-unknown-freebsd.tar.xz) = f5cb293be6f62b918718d926fc95bf83ed6480b8dbd54172dcd5fddb0366411e +SIZE (rust/2021-02-11/rust-std-1.51.0-powerpc-unknown-freebsd.tar.xz) = 17510268 +SHA256 (rust/2021-02-11/cargo-1.51.0-powerpc-unknown-freebsd.tar.xz) = a01c7ac046b0039fea8e3d1fa024360bdcaeaf80a92aec913280fdb91e0358ca +SIZE (rust/2021-02-11/cargo-1.51.0-powerpc-unknown-freebsd.tar.xz) = 4948280 SHA256 (rust/2021-02-11/rustc-1.50.0-powerpc64-unknown-freebsd-elfv1.tar.xz) = a215d00ffd5e561471ded1ee546c66b3852c83a727f459c3c224eb78cfd67fd5 SIZE (rust/2021-02-11/rustc-1.50.0-powerpc64-unknown-freebsd-elfv1.tar.xz) = 55203080 SHA256 (rust/2021-02-11/rust-std-1.50.0-powerpc64-unknown-freebsd-elfv1.tar.xz) = c80da6b2b3ba447550c311eda47748e1cf6620e095bec5e60c65d24e711f7eb6 diff --git a/lang/rust/files/powerpc/patch-compiler_rustc__target_src_spec_mod.rs b/lang/rust/files/powerpc/patch-compiler_rustc__target_src_spec_mod.rs new file mode 100644 index 000000000000..31cd984c264e --- /dev/null +++ b/lang/rust/files/powerpc/patch-compiler_rustc__target_src_spec_mod.rs @@ -0,0 +1,10 @@ +--- compiler/rustc_target/src/spec/mod.rs.orig 2020-09-30 18:06:16.613040000 -0500 ++++ compiler/rustc_target/src/spec/mod.rs 2021-04-23 18:06:47.040460000 -0500 +@@ -765,6 +765,7 @@ fn $module() { + ("armv6-unknown-freebsd", armv6_unknown_freebsd), + ("armv7-unknown-freebsd", armv7_unknown_freebsd), + ("i686-unknown-freebsd", i686_unknown_freebsd), ++ ("powerpc-unknown-freebsd", powerpc_unknown_freebsd), + ("powerpc64-unknown-freebsd", powerpc64_unknown_freebsd), + ("x86_64-unknown-freebsd", x86_64_unknown_freebsd), + diff --git a/lang/rust/files/powerpc/patch-compiler_rustc__target_src_spec_powerpc__unknown__freebsd.rs b/lang/rust/files/powerpc/patch-compiler_rustc__target_src_spec_powerpc__unknown__freebsd.rs new file mode 100644 index 000000000000..8c49456804e6 --- /dev/null +++ b/lang/rust/files/powerpc/patch-compiler_rustc__target_src_spec_powerpc__unknown__freebsd.rs @@ -0,0 +1,27 @@ +--- /dev/null 2021-04-24 17:00:30.889028000 -0500 ++++ compiler/rustc_target/src/spec/powerpc_unknown_freebsd.rs 2021-04-24 17:00:25.903298000 -0500 +@@ -0,0 +1,24 @@ ++use crate::abi::Endian; ++use crate::spec::{CodeModel, LinkerFlavor, RelocModel, Target, TargetOptions}; ++ ++pub fn target() -> Target { ++ let mut base = super::freebsd_base::opts(); ++ base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m32".to_string()); ++ base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("--target=powerpc-unknown-freebsd13.0".to_string()); ++ base.max_atomic_width = Some(32); ++ ++ Target { ++ llvm_target: "powerpc-unknown-freebsd13.0".to_string(), ++ pointer_width: 32, ++ data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(), ++ arch: "powerpc".to_string(), ++ options: TargetOptions { ++ endian: Endian::Big, ++ code_model: Some(CodeModel::Large), ++ features: "+secure-plt".to_string(), ++ relocation_model: RelocModel::Pic, ++ mcount: "_mcount".to_string(), ++ ..base ++ }, ++ } ++} diff --git a/lang/rust/files/powerpc/patch-src_llvm__project_llvm_lib_Driver_ToolChains_Arch_PPC.cpp b/lang/rust/files/powerpc/patch-src_llvm__project_llvm_lib_Driver_ToolChains_Arch_PPC.cpp new file mode 100644 index 000000000000..1792812b212d --- /dev/null +++ b/lang/rust/files/powerpc/patch-src_llvm__project_llvm_lib_Driver_ToolChains_Arch_PPC.cpp @@ -0,0 +1,12 @@ +--- src/llvm-project/clang/lib/Driver/ToolChains/Arch/PPC.cpp.orig 2021-04-27 07:29:31.811399000 -0500 ++++ src/llvm-project/clang/lib/Driver/ToolChains/Arch/PPC.cpp 2021-04-27 07:40:14.185257000 -0500 +@@ -126,7 +126,8 @@ ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Dr + const ArgList &Args) { + if (Args.getLastArg(options::OPT_msecure_plt)) + return ppc::ReadGOTPtrMode::SecurePlt; +- if ((Triple.isOSFreeBSD() && Triple.getOSMajorVersion() >= 13) || ++ if ((Triple.isOSFreeBSD() && ++ (Triple.getOSMajorVersion() == 0 || Triple.getOSMajorVersion() >= 13)) || + Triple.isOSNetBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) + return ppc::ReadGOTPtrMode::SecurePlt; + else diff --git a/lang/rust/files/powerpc/patch-src_llvm__project_llvm_lib_Target_PowerPC_PPCSubtarget.cpp b/lang/rust/files/powerpc/patch-src_llvm__project_llvm_lib_Target_PowerPC_PPCSubtarget.cpp new file mode 100644 index 000000000000..363094b72fae --- /dev/null +++ b/lang/rust/files/powerpc/patch-src_llvm__project_llvm_lib_Target_PowerPC_PPCSubtarget.cpp @@ -0,0 +1,13 @@ +--- src/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp.orig 2021-04-27 07:17:18.744914000 -0500 ++++ src/llvm-project/llvm/lib/Target/PowerPC/PPCSubtarget.cpp 2021-04-27 07:25:23.450714000 -0500 +@@ -151,7 +151,9 @@ void PPCSubtarget::initSubtargetFeatures(StringRef CPU + if (IsPPC64 && has64BitSupport()) + Use64BitRegs = true; + +- if ((TargetTriple.isOSFreeBSD() && TargetTriple.getOSMajorVersion() >= 13) || ++ if ((TargetTriple.isOSFreeBSD() && ++ (TargetTriple.getOSMajorVersion() == 0 || ++ TargetTriple.getOSMajorVersion() >= 13)) || + TargetTriple.isOSNetBSD() || TargetTriple.isOSOpenBSD() || + TargetTriple.isMusl()) + SecurePlt = true; diff --git a/lang/rust/files/powerpc/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_mod.rs b/lang/rust/files/powerpc/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_mod.rs new file mode 100644 index 000000000000..4852d7daf4d1 --- /dev/null +++ b/lang/rust/files/powerpc/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_mod.rs @@ -0,0 +1,12 @@ +--- vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs.orig ++++ vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs +@@ -1568,6 +1568,9 @@ cfg_if! { + } else if #[cfg(target_arch = "arm")] { + mod arm; + pub use self::arm::*; ++ } else if #[cfg(target_arch = "powerpc")] { ++ mod powerpc; ++ pub use self::powerpc::*; + } else if #[cfg(target_arch = "powerpc64")] { + mod powerpc64; + pub use self::powerpc64::*; diff --git a/lang/rust/files/powerpc/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_powerpc.rs b/lang/rust/files/powerpc/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_powerpc.rs new file mode 100644 index 000000000000..9e74de7b6fdf --- /dev/null +++ b/lang/rust/files/powerpc/patch-vendor_libc_src_unix_bsd_freebsdlike_freebsd_powerpc.rs @@ -0,0 +1,50 @@ +--- /dev/null ++++ vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc.rs +@@ -0,0 +1,47 @@ ++pub type c_char = u8; ++pub type c_long = i32; ++pub type c_ulong = u32; ++pub type wchar_t = u32; ++pub type time_t = i64; ++pub type suseconds_t = i32; ++pub type register_t = i32; ++ ++s! { ++ pub struct stat { ++ pub st_dev: ::dev_t, ++ pub st_ino: ::ino_t, ++ pub st_mode: ::mode_t, ++ pub st_nlink: ::nlink_t, ++ pub st_uid: ::uid_t, ++ pub st_gid: ::gid_t, ++ pub st_rdev: ::dev_t, ++ pub st_atime: ::time_t, ++ pub st_atime_nsec: ::c_long, ++ pub st_mtime: ::time_t, ++ pub st_mtime_nsec: ::c_long, ++ pub st_ctime: ::time_t, ++ pub st_ctime_nsec: ::c_long, ++ pub st_size: ::off_t, ++ pub st_blocks: ::blkcnt_t, ++ pub st_blksize: ::blksize_t, ++ pub st_flags: ::fflags_t, ++ pub st_gen: u32, ++ pub st_lspare: i32, ++ pub st_birthtime: ::time_t, ++ pub st_birthtime_nsec: ::c_long, ++ __unused: [u8; 8], ++ } ++} ++ ++// should be pub(crate), but that requires Rust 1.18.0 ++cfg_if! { ++ if #[cfg(libc_const_size_of)] { ++ #[doc(hidden)] ++ pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; ++ } else { ++ #[doc(hidden)] ++ pub const _ALIGNBYTES: usize = 4 - 1; ++ } ++} ++pub const MAP_32BIT: ::c_int = 0x00080000; ++pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 diff --git a/lang/rust/files/powerpc/patch-vendor_openssl__src_src_lib.rs b/lang/rust/files/powerpc/patch-vendor_openssl__src_src_lib.rs new file mode 100644 index 000000000000..444fb6e9687d --- /dev/null +++ b/lang/rust/files/powerpc/patch-vendor_openssl__src_src_lib.rs @@ -0,0 +1,10 @@ +--- vendor/openssl-src/src/lib.rs.orig 2021-04-23 22:26:56.124321000 -0500 ++++ vendor/openssl-src/src/lib.rs 2021-04-23 22:27:38.643235000 -0500 +@@ -194,6 +194,7 @@ impl Build { + "mips64el-unknown-linux-gnuabi64" => "linux64-mips64", + "mipsel-unknown-linux-gnu" => "linux-mips32", + "mipsel-unknown-linux-musl" => "linux-mips32", ++ "powerpc-unknown-freebsd" => "BSD-generic32", + "powerpc-unknown-linux-gnu" => "linux-ppc", + "powerpc64-unknown-freebsd" => "BSD-generic64", + "powerpc64-unknown-linux-gnu" => "linux-ppc64", diff --git a/lang/rust/files/powerpc/patch-vendor_rustc__ap__rustc__target_src_spec_mod.rs b/lang/rust/files/powerpc/patch-vendor_rustc__ap__rustc__target_src_spec_mod.rs new file mode 100644 index 000000000000..7f951fb9a43e --- /dev/null +++ b/lang/rust/files/powerpc/patch-vendor_rustc__ap__rustc__target_src_spec_mod.rs @@ -0,0 +1,10 @@ +--- vendor/rustc-ap-rustc_target/src/spec/mod.rs.orig 2021-04-24 18:21:48.422522000 -0500 ++++ vendor/rustc-ap-rustc_target/src/spec/mod.rs 2021-04-24 18:22:21.105142000 -0500 +@@ -684,6 +684,7 @@ supported_targets! { + ("armv6-unknown-freebsd", armv6_unknown_freebsd), + ("armv7-unknown-freebsd", armv7_unknown_freebsd), + ("i686-unknown-freebsd", i686_unknown_freebsd), ++ ("powerpc-unknown-freebsd", powerpc_unknown_freebsd), + ("powerpc64-unknown-freebsd", powerpc64_unknown_freebsd), + ("x86_64-unknown-freebsd", x86_64_unknown_freebsd), + diff --git a/lang/rust/files/powerpc/patch-vendor_rustc__ap__rustc__target_src_spec_powerpc__unknown__freebsd.rs b/lang/rust/files/powerpc/patch-vendor_rustc__ap__rustc__target_src_spec_powerpc__unknown__freebsd.rs new file mode 100644 index 000000000000..63b83f74ff6c --- /dev/null +++ b/lang/rust/files/powerpc/patch-vendor_rustc__ap__rustc__target_src_spec_powerpc__unknown__freebsd.rs @@ -0,0 +1,27 @@ +--- /dev/null 2021-04-24 17:00:30.889028000 -0500 ++++ vendor/rustc-ap-rustc_target/src/spec/powerpc_unknown_freebsd.rs 2021-04-24 17:00:25.903298000 -0500 +@@ -0,0 +1,24 @@ ++use crate::abi::Endian; ++use crate::spec::{CodeModel, LinkerFlavor, RelocModel, Target, TargetOptions}; ++ ++pub fn target() -> Target { ++ let mut base = super::freebsd_base::opts(); ++ base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("-m32".to_string()); ++ base.pre_link_args.entry(LinkerFlavor::Gcc).or_default().push("--target=powerpc-unknown-freebsd13.0".to_string()); ++ base.max_atomic_width = Some(32); ++ ++ Target { ++ llvm_target: "powerpc-unknown-freebsd13.0".to_string(), ++ pointer_width: 32, ++ data_layout: "E-m:e-p:32:32-i64:64-n32".to_string(), ++ arch: "powerpc".to_string(), ++ options: TargetOptions { ++ endian: Endian::Big, ++ code_model: Some(CodeModel::Large), ++ features: "+secure-plt".to_string(), ++ relocation_model: RelocModel::Pic, ++ mcount: "_mcount".to_string(), ++ ..base ++ }, ++ } ++}