Cleanup Trusty target patch
Address various bits of feedback from the upstream PR.
Bug: 253625544
Test: com.android.trusty.rust.*
Change-Id: I5252f32b9c73b0d9351a643f9d2d23dbe90b7ace
diff --git a/patches/development/rustc-0023-Add-Trusty-OS-support-to-Rust-std.patch b/patches/development/rustc-0023-Add-Trusty-OS-support-to-Rust-std.patch
index 9cfda78..9d1ba61 100644
--- a/patches/development/rustc-0023-Add-Trusty-OS-support-to-Rust-std.patch
+++ b/patches/development/rustc-0023-Add-Trusty-OS-support-to-Rust-std.patch
@@ -31,25 +31,25 @@
@@ -0,0 +1,27 @@
+// Trusty OS target for AArch64.
+
-+use super::{PanicStrategy, Target, TargetOptions, RelroLevel};
++use super::{PanicStrategy, Target, TargetOptions, RelroLevel, crt_objects::LinkSelfContainedDefault};
+
+pub fn target() -> Target {
+ Target {
-+ llvm_target: "aarch64-unknown-linux-musl".into(),
++ llvm_target: "aarch64-unknown-unknown-musl".into(),
+ pointer_width: 64,
+ data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".into(),
+ arch: "aarch64".into(),
+ options: TargetOptions {
-+ features: "+neon,+fp-armv8".into(),
++ features: "+neon,+fp-armv8,+reserve-x18".into(),
+ executables: true,
+ max_atomic_width: Some(128),
+ panic_strategy: PanicStrategy::Abort,
+ os: "trusty".into(),
-+ position_independent_executables: true,
++ link_self_contained: LinkSelfContainedDefault::Musl,
++ static_position_independent_executables: true,
+ crt_static_default: true,
-+ crt_static_respected: true,
++ crt_static_respected: false,
+ dynamic_linking: false,
-+ env: "musl".into(),
+ relro_level: RelroLevel::Full,
+ mcount: "\u{1}_mcount".into(),
+ ..Default::default()
@@ -61,7 +61,7 @@
index 0000000000..9ee5c3e65b
--- /dev/null
+++ b/compiler/rustc_target/src/spec/armv7_unknown_trusty.rs
-@@ -0,0 +1,31 @@
+@@ -0,0 +1,32 @@
+use crate::spec::{Target, TargetOptions};
+
+use super::{PanicStrategy, RelroLevel, crt_objects::LinkSelfContainedDefault};
@@ -71,23 +71,24 @@
+ // It's important we use "gnueabi" and not "musleabi" here. LLVM uses it
+ // to determine the calling convention and float ABI, and it doesn't
+ // support the "musleabi" value.
-+ llvm_target: "armv7-unknown-linux-gnueabi".into(),
++ llvm_target: "armv7-unknown-unknown-gnueabi".into(),
+ pointer_width: 32,
+ data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
+ arch: "arm".into(),
+ options: TargetOptions {
+ abi: "eabi".into(),
-+ features: "+v7,+thumb2,+soft-float,-neon".into(),
++ features: "+v7,+thumb2,+soft-float,-neon,+reserve-x18".into(),
+ max_atomic_width: Some(64),
+ mcount: "\u{1}mcount".into(),
+ os: "trusty".into(),
-+ env: "musl".into(),
+ link_self_contained: LinkSelfContainedDefault::Musl,
+ dynamic_linking: false,
+ executables: true,
++ crt_static_default: true,
++ crt_static_respected: false,
+ relro_level: RelroLevel::Full,
+ panic_strategy: PanicStrategy::Abort,
-+ position_independent_executables: true,
++ static_position_independent_executables: true,
+
+ ..Default::default()
+ },
@@ -333,4 +334,3 @@
all(target_vendor = "fortanix", target_env = "sgx")))] {
--
2.37.1.559.g78731f0fdb-goog
-