summaryrefslogtreecommitdiffstats
path: root/vendor/psm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:25 +0000
commit5363f350887b1e5b5dd21a86f88c8af9d7fea6da (patch)
tree35ca005eb6e0e9a1ba3bb5dbc033209ad445dc17 /vendor/psm
parentAdding debian version 1.66.0+dfsg1-1. (diff)
downloadrustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.tar.xz
rustc-5363f350887b1e5b5dd21a86f88c8af9d7fea6da.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/psm')
-rw-r--r--vendor/psm/.cargo-checksum.json2
-rw-r--r--vendor/psm/Cargo.lock6
-rw-r--r--vendor/psm/Cargo.toml12
-rw-r--r--vendor/psm/README.mkd31
-rw-r--r--vendor/psm/build.rs41
-rw-r--r--vendor/psm/src/arch/aarch_aapcs64.s7
-rw-r--r--vendor/psm/src/arch/loongarch64.s63
-rw-r--r--vendor/psm/src/arch/powerpc64_aix.s137
-rw-r--r--vendor/psm/src/arch/riscv.s5
-rw-r--r--vendor/psm/src/arch/riscv64.s5
-rw-r--r--vendor/psm/src/lib.rs2
11 files changed, 274 insertions, 37 deletions
diff --git a/vendor/psm/.cargo-checksum.json b/vendor/psm/.cargo-checksum.json
index a69778b20..d9a8ecf51 100644
--- a/vendor/psm/.cargo-checksum.json
+++ b/vendor/psm/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.lock":"2928b712f89aee2b62581df1e552b7cb8288d999ba180291b4900b86a05c6d8d","Cargo.toml":"c2c5a0154a80cffc82349cd98f819ea1259c92f195c5878ceefb66e06b14d28c","LICENSE-APACHE":"965a63a81d9a2fbeb5f9096954dabb49690f9dffcdac9825f675b25c807252a2","LICENSE-MIT":"3e3714aa69bd874601741fd7d7ad5298740cece37778e279fc1ab4451c5a11af","README.mkd":"6385ecaced99b0a29a5b40166d34ef9312f322c1b8ad002bef3b08cd6c3e29b2","build.rs":"1d7872546e6924bbb2947edc055ddd01f48683cc80d9d75a846adb65540345f0","examples/info.rs":"8ffb89912304ecbf3d714dcc094f42e86fdd0738625b2e76be2e7d59ab0736cf","examples/on_stack_fibo.rs":"287f0a08b177a97366a5da39e24e33e1f4bbe30a1f2473956721c8a9d93926a4","examples/on_stack_fibo_alloc_each_frame.rs":"e084041bbb81d51b195a4db539a765409272916df29c83a62213a93de4b6fca3","examples/panics.rs":"6791fe0dda9456b3becf989cbc89bc45ae27302e633572a57bbf10a57b830076","examples/replace_stack_1.rs":"374a28881f5e5dbf9db9b9e34929fb7a7e6f3910d782a6718f53ac269807b990","examples/thread.rs":"3cf92882aff96151608584d63535701cc8e5ae953d7ecf706d77371180bff025","src/arch/aarch64_armasm.asm":"1c737338287f3de981fbae97f104ac5e49425ba7fbcb4f7d80120afae47a86d5","src/arch/aarch_aapcs64.s":"459b8cd5a96104893e8f849ac83369101d7204c933841672df162104bebd2375","src/arch/arm_aapcs.s":"4ada635e8528279bd0326654f5203b6bdc94dd68c94fdef5de551384ba1b1747","src/arch/arm_armasm.asm":"e3b514169f19368b0b49374412de38bd9f50576e7b93b64d685a0f84fa8f4c91","src/arch/mips64_eabi.s":"4e6f95f89ba72fc4dd1a9a547920764f66d98251d236941cee4d227010484520","src/arch/mips_eabi.s":"8b7927fd63660eb276e2951f28df6b11920f04be4dc17a16b66ad386da12c4c3","src/arch/powerpc32.s":"0b508a65dec7254ba2e0dc65a2c9e86c21069fe62f5d7c41f5190415a4885912","src/arch/powerpc64.s":"c1602d09d12ba1df48fc96af0f827f8679fc93cee728813527fb1b817a788911","src/arch/powerpc64_openpower.s":"421b11cc7381427d1e2acb4e681c9836ccfea0b79930492f0a99ec4d27495e58","src/arch/psm.h":"2cebda3740aa73b167b8ec18e3d2202ca46e400a081a46329b86051abd1a872a","src/arch/riscv.s":"a81d2af4bcc9c29db304730697e52a89a7376b51d2735185c67be8910d0cdf39","src/arch/riscv64.s":"a51da67ce569e2442ff487b062bb8fdfe7c769f3f05a88de480bd5ab214d9a4f","src/arch/sparc64.s":"6250acbd938aea2e440061663a79fbb2dac0592b3a193f027b6b910e2a8e3af1","src/arch/sparc_sysv.s":"c2da7576e1fbe2234cc8a5cf937f7676e125435295f8c32089bfa0b0f27fde5e","src/arch/wasm32.o":"d7279f419cb7e169cae2af2463507652e0393b801c2f4580244de70d3def58b6","src/arch/wasm32.s":"1ebdc90de48f13e6474ee17c406578fc090ff61e57c1f560ecf6e6b75c7ef10a","src/arch/x86.s":"1919a4af1474895f904ed4281a4a8fcdd0428dab257bff4ea262db83ed63b445","src/arch/x86_64.s":"c80f1a3e22db61fd62b5ef2e1b6663185403bdcbcfbfe7ff0f8e0831ff0cafcf","src/arch/x86_64_msvc.asm":"85683bc65a03371ea7d8d79dcbe487f690cc2460c359817fc63c30d575ad8957","src/arch/x86_64_windows_gnu.s":"44637034e094ec0ad76dbe1232e97271c8155eb93bcb1dd86fe825acd05978a0","src/arch/x86_msvc.asm":"1735d4b19f8e46d0699fc9538baa7ab0885d27531ef7d9960e2027ad8137769b","src/arch/x86_windows_gnu.s":"b94d907a86f230c5c8ca1c708ede173f73c5269496f3959e08e4a92155e160d7","src/arch/zseries_linux.s":"5c3379a76e31bf13abf240efda12596fabce108cf63f60f9d0495e82ab8f1717","src/lib.rs":"18774ee37630bc6c7a36273014f80f6afa3f73bf34f4c49f5795d2eb5df1c195","tests/stack_direction.rs":"77d8f9dee196e99e70d569f59fef82bc2f88a8ec17bfe07ebe2f005fcb815c8b","tests/stack_direction_2.rs":"f9191394de5b6381af6ba8223e7717230059dc335f639238c0ddbc7eb87bfc0e"},"package":"cd136ff4382c4753fc061cb9e4712ab2af263376b95bbd5bd8cd50c020b78e69"} \ No newline at end of file
+{"files":{"Cargo.lock":"f340c8bae87c38b7c025f5a130b1f4fa81a156691548b1c4368337aa8eaf560a","Cargo.toml":"e8bcceb61588d623d77dad9ee9c802e2ef2ac69600b13b37a26e02f743828b71","LICENSE-APACHE":"965a63a81d9a2fbeb5f9096954dabb49690f9dffcdac9825f675b25c807252a2","LICENSE-MIT":"3e3714aa69bd874601741fd7d7ad5298740cece37778e279fc1ab4451c5a11af","README.mkd":"973e82d1604900e47b087c81511d021c68ca296ba9ca92a3211b048482bac502","build.rs":"53bf9957fad30598007daff1f0969c2a79991aaf80f4b4226c132fa664553771","examples/info.rs":"8ffb89912304ecbf3d714dcc094f42e86fdd0738625b2e76be2e7d59ab0736cf","examples/on_stack_fibo.rs":"287f0a08b177a97366a5da39e24e33e1f4bbe30a1f2473956721c8a9d93926a4","examples/on_stack_fibo_alloc_each_frame.rs":"e084041bbb81d51b195a4db539a765409272916df29c83a62213a93de4b6fca3","examples/panics.rs":"6791fe0dda9456b3becf989cbc89bc45ae27302e633572a57bbf10a57b830076","examples/replace_stack_1.rs":"374a28881f5e5dbf9db9b9e34929fb7a7e6f3910d782a6718f53ac269807b990","examples/thread.rs":"3cf92882aff96151608584d63535701cc8e5ae953d7ecf706d77371180bff025","src/arch/aarch64_armasm.asm":"1c737338287f3de981fbae97f104ac5e49425ba7fbcb4f7d80120afae47a86d5","src/arch/aarch_aapcs64.s":"69c1c760e60e9855fedb59cadf1adb1c71a0f7f18278e42a89ed75e9c0eec4ce","src/arch/arm_aapcs.s":"4ada635e8528279bd0326654f5203b6bdc94dd68c94fdef5de551384ba1b1747","src/arch/arm_armasm.asm":"e3b514169f19368b0b49374412de38bd9f50576e7b93b64d685a0f84fa8f4c91","src/arch/loongarch64.s":"8bcdca0741c0cfd164e4541e0eaf00c80ca156479cd8a9c617bd388797551d5e","src/arch/mips64_eabi.s":"4e6f95f89ba72fc4dd1a9a547920764f66d98251d236941cee4d227010484520","src/arch/mips_eabi.s":"8b7927fd63660eb276e2951f28df6b11920f04be4dc17a16b66ad386da12c4c3","src/arch/powerpc32.s":"0b508a65dec7254ba2e0dc65a2c9e86c21069fe62f5d7c41f5190415a4885912","src/arch/powerpc64.s":"c1602d09d12ba1df48fc96af0f827f8679fc93cee728813527fb1b817a788911","src/arch/powerpc64_aix.s":"79af120692de207ea9e78efca92127ed1b522dcac62f6d17ed48f88458203a01","src/arch/powerpc64_openpower.s":"421b11cc7381427d1e2acb4e681c9836ccfea0b79930492f0a99ec4d27495e58","src/arch/psm.h":"2cebda3740aa73b167b8ec18e3d2202ca46e400a081a46329b86051abd1a872a","src/arch/riscv.s":"81a40bd95f7e93990725c5872dbef90d4844af05b15b910dde05787bdcf8482b","src/arch/riscv64.s":"5a60ac5df014152cb7630121bf97b143075211a738717993c17a70ea9519ac49","src/arch/sparc64.s":"6250acbd938aea2e440061663a79fbb2dac0592b3a193f027b6b910e2a8e3af1","src/arch/sparc_sysv.s":"c2da7576e1fbe2234cc8a5cf937f7676e125435295f8c32089bfa0b0f27fde5e","src/arch/wasm32.o":"d7279f419cb7e169cae2af2463507652e0393b801c2f4580244de70d3def58b6","src/arch/wasm32.s":"1ebdc90de48f13e6474ee17c406578fc090ff61e57c1f560ecf6e6b75c7ef10a","src/arch/x86.s":"1919a4af1474895f904ed4281a4a8fcdd0428dab257bff4ea262db83ed63b445","src/arch/x86_64.s":"c80f1a3e22db61fd62b5ef2e1b6663185403bdcbcfbfe7ff0f8e0831ff0cafcf","src/arch/x86_64_msvc.asm":"85683bc65a03371ea7d8d79dcbe487f690cc2460c359817fc63c30d575ad8957","src/arch/x86_64_windows_gnu.s":"44637034e094ec0ad76dbe1232e97271c8155eb93bcb1dd86fe825acd05978a0","src/arch/x86_msvc.asm":"1735d4b19f8e46d0699fc9538baa7ab0885d27531ef7d9960e2027ad8137769b","src/arch/x86_windows_gnu.s":"b94d907a86f230c5c8ca1c708ede173f73c5269496f3959e08e4a92155e160d7","src/arch/zseries_linux.s":"5c3379a76e31bf13abf240efda12596fabce108cf63f60f9d0495e82ab8f1717","src/lib.rs":"3f1dcc4d0d3b67d5622ae6be1e4a55f56e09fc4585379f8aa307125690595ebb","tests/stack_direction.rs":"77d8f9dee196e99e70d569f59fef82bc2f88a8ec17bfe07ebe2f005fcb815c8b","tests/stack_direction_2.rs":"f9191394de5b6381af6ba8223e7717230059dc335f639238c0ddbc7eb87bfc0e"},"package":"5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874"} \ No newline at end of file
diff --git a/vendor/psm/Cargo.lock b/vendor/psm/Cargo.lock
index 8473e9f72..5c633edf9 100644
--- a/vendor/psm/Cargo.lock
+++ b/vendor/psm/Cargo.lock
@@ -4,13 +4,13 @@ version = 3
[[package]]
name = "cc"
-version = "1.0.69"
+version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e70cc2f62c6ce1868963827bd677764c62d07c3d9a3e1fb1177ee1a9ab199eb2"
+checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]]
name = "psm"
-version = "0.1.16"
+version = "0.1.21"
dependencies = [
"cc",
]
diff --git a/vendor/psm/Cargo.toml b/vendor/psm/Cargo.toml
index cf2c97b3f..7d921b86b 100644
--- a/vendor/psm/Cargo.toml
+++ b/vendor/psm/Cargo.toml
@@ -11,16 +11,20 @@
[package]
name = "psm"
-version = "0.1.16"
+version = "0.1.21"
authors = ["Simonas Kazlauskas <psm@kazlauskas.me>"]
build = "build.rs"
description = "Portable Stack Manipulation: stack manipulation and introspection routines"
-documentation = "https://docs.rs/psm/0.1.14"
+documentation = "https://docs.rs/psm/0.1.20"
readme = "README.mkd"
-keywords = ["stack", "no_std"]
-license = "MIT/Apache-2.0"
+keywords = [
+ "stack",
+ "no_std",
+]
+license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/stacker/"
[dependencies]
+
[build-dependencies.cc]
version = "1.0.2"
diff --git a/vendor/psm/README.mkd b/vendor/psm/README.mkd
index 441763873..5bc89577f 100644
--- a/vendor/psm/README.mkd
+++ b/vendor/psm/README.mkd
@@ -289,7 +289,7 @@ compiler-generated code fails at similar points itself.
</tr>
<tr>
-<td rowspan="2">powerpc64</td>
+<td rowspan="4">powerpc64</td>
<td rowspan="2">linux</td>
<td>Yes</td>
<td>Yes</td>
@@ -305,6 +305,16 @@ compiler-generated code fails at similar points itself.
</tr>
<tr>
+<td rowspan="2">AIX</td>
+<td>Yes</td>
+<td>Yes</td>
+<td>Yes</td>
+<tr>
+<td colspan="3">
+</td>
+</tr>
+
+<tr>
<td rowspan="2">powerpc64le</td>
<td rowspan="2">linux</td>
<td>Yes</td>
@@ -478,6 +488,21 @@ The assembly code for riscv64 has been tested locally with a C caller.
</td>
</tr>
+
+<tr>
+<td rowspan="2">loongarch64</td>
+<td rowspan="2">&#42;</td>
+<td>Yes</td>
+<td>Locally</td>
+<td>Unknown</td>
+</tr>
+<tr>
+<td colspan="3">
+
+The assembly code for loongarch64 has been tested locally with a C caller.
+
+</td>
+</tr>
</table>
[GCC Farm Project]: https://cfarm.tetaneutral.net/
@@ -488,8 +513,8 @@ The assembly code for riscv64 has been tested locally with a C caller.
PSM is licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
- http://www.apache.org/licenses/LICENSE-2.0)
+ https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
- http://opensource.org/licenses/MIT)
+ https://opensource.org/licenses/MIT)
at your option.
diff --git a/vendor/psm/build.rs b/vendor/psm/build.rs
index 01a13bf71..9d40212eb 100644
--- a/vendor/psm/build.rs
+++ b/vendor/psm/build.rs
@@ -12,14 +12,14 @@ fn find_assembly(
// is not supported in Windows. For x86_64 the implementation actually works locally,
// but failed tests in CI (???). Might want to have a feature for experimental support
// here.
- ("x86", _, "windows", "msvc") => {
+ ("x86", _, "windows", _) => {
if masm {
Some(("src/arch/x86_msvc.asm", false))
} else {
Some(("src/arch/x86_windows_gnu.s", false))
}
}
- ("x86_64", _, "windows", "msvc") => {
+ ("x86_64", _, "windows", _) => {
if masm {
Some(("src/arch/x86_64_msvc.asm", false))
} else {
@@ -27,21 +27,21 @@ fn find_assembly(
}
}
("arm", _, "windows", "msvc") => Some(("src/arch/arm_armasm.asm", false)),
- ("aarch64", _, "windows", "msvc") => {
+ ("aarch64", _, "windows", _) => {
if masm {
Some(("src/arch/aarch64_armasm.asm", false))
} else {
Some(("src/arch/aarch_aapcs64.s", false))
}
}
- ("x86", _, "windows", _) => Some(("src/arch/x86_windows_gnu.s", false)),
- ("x86_64", _, "windows", _) => Some(("src/arch/x86_64_windows_gnu.s", false)),
("x86", _, _, _) => Some(("src/arch/x86.s", true)),
("x86_64", _, _, _) => Some(("src/arch/x86_64.s", true)),
("arm", _, _, _) => Some(("src/arch/arm_aapcs.s", true)),
("aarch64", _, _, _) => Some(("src/arch/aarch_aapcs64.s", true)),
("powerpc", _, _, _) => Some(("src/arch/powerpc32.s", true)),
+ ("powerpc64", _, _, "musl") => Some(("src/arch/powerpc64_openpower.s", true)),
("powerpc64", "little", _, _) => Some(("src/arch/powerpc64_openpower.s", true)),
+ ("powerpc64", _, "aix", _) => Some(("src/arch/powerpc64_aix.s", true)),
("powerpc64", _, _, _) => Some(("src/arch/powerpc64.s", true)),
("s390x", _, _, _) => Some(("src/arch/zseries_linux.s", true)),
("mips", _, _, _) => Some(("src/arch/mips_eabi.s", true)),
@@ -51,29 +51,32 @@ fn find_assembly(
("riscv32", _, _, _) => Some(("src/arch/riscv.s", true)),
("riscv64", _, _, _) => Some(("src/arch/riscv64.s", true)),
("wasm32", _, _, _) => Some(("src/arch/wasm32.o", true)),
+ ("loongarch64", _, _, _) => Some(("src/arch/loongarch64.s", true)),
_ => None,
}
}
fn main() {
- let arch = ::std::env::var("CARGO_CFG_TARGET_ARCH").unwrap();
- let env = ::std::env::var("CARGO_CFG_TARGET_ENV").unwrap();
- let os = ::std::env::var("CARGO_CFG_TARGET_OS").unwrap();
- let endian = ::std::env::var("CARGO_CFG_TARGET_ENDIAN").unwrap();
+ use std::env::var;
- // We are only assembling a single file and any flags in the environment probably
- // don't apply in this case, so we don't want to use them. Unfortunately, cc
- // doesn't provide a way to clear/ignore flags set from the environment, so
- // we manually remove them instead
- for key in
- std::env::vars().filter_map(|(k, _)| if k.contains("CFLAGS") { Some(k) } else { None })
- {
- std::env::remove_var(key);
- }
+ let arch = var("CARGO_CFG_TARGET_ARCH").unwrap();
+ let env = var("CARGO_CFG_TARGET_ENV").unwrap();
+ let os = var("CARGO_CFG_TARGET_OS").unwrap();
+ let endian = var("CARGO_CFG_TARGET_ENDIAN").unwrap();
let mut cfg = cc::Build::new();
+
let msvc = cfg.get_compiler().is_like_msvc();
- let asm = if let Some((asm, canswitch)) = find_assembly(&arch, &endian, &os, &env, msvc) {
+ // If we're targeting msvc, either via regular MS toolchain or clang-cl, we
+ // will _usually_ want to use the regular Microsoft assembler if it exists,
+ // which is done for us within cc, however it _probably_ won't exist if
+ // we're in a cross-compilation context pm a platform that can't natively
+ // run Windows executables, so in that case we instead use the the equivalent
+ // GAS assembly file instead. This logic can be removed once LLVM natively
+ // supports compiling MASM, but that is not stable yet
+ let masm = msvc && var("HOST").expect("HOST env not set").contains("windows");
+
+ let asm = if let Some((asm, canswitch)) = find_assembly(&arch, &endian, &os, &env, masm) {
println!("cargo:rustc-cfg=asm");
if canswitch {
println!("cargo:rustc-cfg=switchable_stack")
diff --git a/vendor/psm/src/arch/aarch_aapcs64.s b/vendor/psm/src/arch/aarch_aapcs64.s
index 55917f329..06a6245c2 100644
--- a/vendor/psm/src/arch/aarch_aapcs64.s
+++ b/vendor/psm/src/arch/aarch_aapcs64.s
@@ -9,6 +9,13 @@
#define FUNCTION(fnname) _##fnname
#define SIZE(fnname,endlabel)
+#elif CFG_TARGET_OS_windows
+
+#define GLOBL(fnname) .globl fnname
+#define TYPE(fnname)
+#define FUNCTION(fnname) fnname
+#define SIZE(fnname,endlabel)
+
#else
#define GLOBL(fnname) .globl fnname
diff --git a/vendor/psm/src/arch/loongarch64.s b/vendor/psm/src/arch/loongarch64.s
new file mode 100644
index 000000000..3fc654963
--- /dev/null
+++ b/vendor/psm/src/arch/loongarch64.s
@@ -0,0 +1,63 @@
+#include "psm.h"
+
+.text
+.globl rust_psm_stack_direction
+.align 2
+.type rust_psm_stack_direction,@function
+rust_psm_stack_direction:
+/* extern "C" fn() -> u8 */
+.cfi_startproc
+ li.w $r4, STACK_DIRECTION_DESCENDING
+ jr $r1
+.rust_psm_stack_direction_end:
+.size rust_psm_stack_direction,.rust_psm_stack_direction_end-rust_psm_stack_direction
+.cfi_endproc
+
+
+.globl rust_psm_stack_pointer
+.align 2
+.type rust_psm_stack_pointer,@function
+rust_psm_stack_pointer:
+/* extern "C" fn() -> *mut u8 */
+.cfi_startproc
+ move $r4, $r3
+ jr $r1
+.rust_psm_stack_pointer_end:
+.size rust_psm_stack_pointer,.rust_psm_stack_pointer_end-rust_psm_stack_pointer
+.cfi_endproc
+
+
+.globl rust_psm_replace_stack
+.align 2
+.type rust_psm_replace_stack,@function
+rust_psm_replace_stack:
+/* extern "C" fn(r4: usize, r5: extern "C" fn(usize), r6: *mut u8) */
+.cfi_startproc
+ move $r3, $r6
+ jr $r5
+.rust_psm_replace_stack_end:
+.size rust_psm_replace_stack,.rust_psm_replace_stack_end-rust_psm_replace_stack
+.cfi_endproc
+
+
+.globl rust_psm_on_stack
+.align 2
+.type rust_psm_on_stack,@function
+rust_psm_on_stack:
+/* extern "C" fn(r4: usize, r5: usize, r6: extern "C" fn(usize, usize), r7: *mut u8) */
+.cfi_startproc
+ st.d $r1, $r7, -8
+ st.d $r3, $r7, -16
+ addi.d $r3, $r7, -16
+ .cfi_def_cfa 3, 16
+ .cfi_offset 1, -8
+ .cfi_offset 3, -16
+ jirl $r1, $r6, 0
+ ld.d $r1, $r3, 8
+ .cfi_restore 1
+ ld.d $r3, $r3, 0
+ .cfi_restore 3
+ jr $r1
+.rust_psm_on_stack_end:
+.size rust_psm_on_stack,.rust_psm_on_stack_end-rust_psm_on_stack
+.cfi_endproc
diff --git a/vendor/psm/src/arch/powerpc64_aix.s b/vendor/psm/src/arch/powerpc64_aix.s
new file mode 100644
index 000000000..eed866004
--- /dev/null
+++ b/vendor/psm/src/arch/powerpc64_aix.s
@@ -0,0 +1,137 @@
+.csect .text[PR],2
+.file "powerpc64_aix.s"
+
+.globl rust_psm_stack_direction[DS]
+.globl .rust_psm_stack_direction
+.align 4
+.csect rust_psm_stack_direction[DS],3
+.vbyte 8, .rust_psm_stack_direction
+.vbyte 8, TOC[TC0]
+.vbyte 8, 0
+.csect .text[PR],2
+.rust_psm_stack_direction:
+# extern "C" fn() -> u8
+ li 3, 2
+ blr
+L..rust_psm_stack_direction_end:
+# Following bytes form the traceback table on AIX.
+# For specification, see https://www.ibm.com/docs/en/aix/7.2?topic=processor-traceback-tables.
+# For implementation, see https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp,
+# `PPCAIXAsmPrinter::emitTracebackTable`.
+.vbyte 4, 0x00000000 # Traceback table begin, for unwinder to search the table.
+.byte 0x00 # Version = 0
+.byte 0x09 # Language = CPlusPlus, since rust is using C++-like LSDA.
+.byte 0x20 # -IsGlobaLinkage, -IsOutOfLineEpilogOrPrologue
+ # +HasTraceBackTableOffset, -IsInternalProcedure
+ # -HasControlledStorage, -IsTOCless
+ # -IsFloatingPointPresent
+ # -IsFloatingPointOperationLogOrAbortEnabled
+.byte 0x40 # -IsInterruptHandler, +IsFunctionNamePresent, -IsAllocaUsed
+ # OnConditionDirective = 0, -IsCRSaved, -IsLRSaved
+.byte 0x80 # +IsBackChainStored, -IsFixup, NumOfFPRsSaved = 0
+.byte 0x00 # -HasExtensionTable, -HasVectorInfo, NumOfGPRsSaved = 0
+.byte 0x00 # NumberOfFixedParms = 0
+.byte 0x01 # NumberOfFPParms = 0, +HasParmsOnStack
+.vbyte 4, L..rust_psm_stack_direction_end-.rust_psm_stack_direction #Function size
+.vbyte 2, 0x0018 # Function name len = 24
+.byte "rust_psm_stack_direction" # Function Name
+
+.globl rust_psm_stack_pointer[DS]
+.globl .rust_psm_stack_pointer
+.align 4
+.csect rust_psm_stack_pointer[DS],3
+.vbyte 8, .rust_psm_stack_pointer
+.vbyte 8, TOC[TC0]
+.vbyte 8, 0
+.csect .text[PR],2
+.rust_psm_stack_pointer:
+# extern "C" fn() -> *mut u8
+ mr 3, 1
+ blr
+L..rust_psm_stack_pointer_end:
+.vbyte 4, 0x00000000
+.byte 0x00
+.byte 0x09
+.byte 0x20
+.byte 0x40
+.byte 0x80
+.byte 0x00
+.byte 0x00
+.byte 0x01
+.vbyte 4, L..rust_psm_stack_pointer_end-.rust_psm_stack_pointer
+.vbyte 2, 0x0016
+.byte "rust_psm_stack_pointer"
+
+.globl rust_psm_replace_stack[DS]
+.globl .rust_psm_replace_stack
+.align 4
+.csect rust_psm_replace_stack[DS],3
+.vbyte 8, .rust_psm_replace_stack
+.vbyte 8, TOC[TC0]
+.vbyte 8, 0
+.csect .text[PR],2
+.rust_psm_replace_stack:
+# extern "C" fn(3: usize, 4: extern "C" fn(usize), 5: *mut u8)
+ # Load the function pointer and toc pointer from TOC and make the call.
+ ld 2, 8(4)
+ ld 4, 0(4)
+ addi 5, 5, -48
+ mr 1, 5
+ mtctr 4
+ bctr
+L..rust_psm_replace_stack_end:
+.vbyte 4, 0x00000000
+.byte 0x00
+.byte 0x09
+.byte 0x20
+.byte 0x40
+.byte 0x80
+.byte 0x00
+.byte 0x03
+.byte 0x01
+.vbyte 4, 0x00000000 # Parameter type = i, i, i
+.vbyte 4, L..rust_psm_replace_stack_end-.rust_psm_replace_stack
+.vbyte 2, 0x0016
+.byte "rust_psm_replace_stack"
+
+.globl rust_psm_on_stack[DS]
+.globl .rust_psm_on_stack
+.align 4
+.csect rust_psm_on_stack[DS],3
+.vbyte 8, .rust_psm_on_stack
+.vbyte 8, TOC[TC0]
+.vbyte 8, 0
+.csect .text[PR],2
+.rust_psm_on_stack:
+# extern "C" fn(3: usize, 4: usize, 5: extern "C" fn(usize, usize), 6: *mut u8)
+ mflr 0
+ std 2, -72(6)
+ std 0, -8(6)
+ sub 6, 6, 1
+ addi 6, 6, -112
+ stdux 1, 1, 6
+ ld 2, 8(5)
+ ld 5, 0(5)
+ mtctr 5
+ bctrl
+ ld 2, 40(1)
+ ld 0, 104(1)
+ mtlr 0
+ ld 1, 0(1)
+ blr
+L..rust_psm_on_stack_end:
+.vbyte 4, 0x00000000
+.byte 0x00
+.byte 0x09
+.byte 0x20
+.byte 0x41
+.byte 0x80
+.byte 0x00
+.byte 0x04
+.byte 0x01
+.vbyte 4, 0x00000000 # Parameter type = i, i, i, i
+.vbyte 4, L..rust_psm_on_stack_end-.rust_psm_on_stack
+.vbyte 2, 0x0011
+.byte "rust_psm_on_stack"
+
+.toc
diff --git a/vendor/psm/src/arch/riscv.s b/vendor/psm/src/arch/riscv.s
index 4972993c9..f74779f02 100644
--- a/vendor/psm/src/arch/riscv.s
+++ b/vendor/psm/src/arch/riscv.s
@@ -48,11 +48,10 @@ rust_psm_on_stack:
.cfi_startproc
sw x1, -12(x13)
sw x2, -16(x13)
- .cfi_def_cfa x13, 0
+ addi x2, x13, -16
+ .cfi_def_cfa x2, 16
.cfi_offset x1, -12
.cfi_offset x2, -16
- addi x2, x13, -16
- .cfi_def_cfa x2, -16
jalr x1, x12, 0
lw x1, 4(x2)
.cfi_restore x1
diff --git a/vendor/psm/src/arch/riscv64.s b/vendor/psm/src/arch/riscv64.s
index 1b275ec27..279f735e3 100644
--- a/vendor/psm/src/arch/riscv64.s
+++ b/vendor/psm/src/arch/riscv64.s
@@ -48,11 +48,10 @@ rust_psm_on_stack:
.cfi_startproc
sd x1, -8(x13)
sd x2, -16(x13)
- .cfi_def_cfa x13, 0
+ addi x2, x13, -16
+ .cfi_def_cfa x2, 16
.cfi_offset x1, -8
.cfi_offset x2, -16
- addi x2, x13, -16
- .cfi_def_cfa x2, -16
jalr x1, x12, 0
ld x1, 8(x2)
.cfi_restore x1
diff --git a/vendor/psm/src/lib.rs b/vendor/psm/src/lib.rs
index 61ab9a85b..b9050c833 100644
--- a/vendor/psm/src/lib.rs
+++ b/vendor/psm/src/lib.rs
@@ -56,7 +56,7 @@ macro_rules! extern_item {
// NB: this could be nicer across multiple blocks but we cannot do it because of
// https://github.com/rust-lang/rust/issues/65847
extern_item! { {
- #![link(name="psm_s")]
+ #![cfg_attr(asm, link(name="psm_s"))]
#[cfg(asm)]
fn rust_psm_stack_direction() -> u8;