about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm
diff options
context:
space:
mode:
authorMichael Karcher <github@mkarcher.dialup.fu-berlin.de>2018-12-23 20:33:52 +0100
committerJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>2018-12-23 23:46:45 +0100
commit65dabd6eaf24bbf3b7069a51984411aea2864856 (patch)
tree2a8bafa791af7556393ba34a5f1270baf84cf80e /src/librustc_codegen_llvm
parentddab10a692aab2e2984b5c826ed9d78a57e94851 (diff)
downloadrust-65dabd6eaf24bbf3b7069a51984411aea2864856.tar.gz
rust-65dabd6eaf24bbf3b7069a51984411aea2864856.zip
librustc_codegen_llvm: Don't eliminate empty structs in C ABI on linux-sparc64
This is in accordance with the SPARC Compliance Definition 2.4.1,
Page 3P-12. It says that structs of up to 8 bytes (which applies
to empty structs as well) are to be passed in one register.
Diffstat (limited to 'src/librustc_codegen_llvm')
-rw-r--r--src/librustc_codegen_llvm/abi.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs
index b8954dee794..c083137f085 100644
--- a/src/librustc_codegen_llvm/abi.rs
+++ b/src/librustc_codegen_llvm/abi.rs
@@ -456,6 +456,9 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
         let linux_s390x = target.target_os == "linux"
                        && target.arch == "s390x"
                        && target.target_env == "gnu";
+        let linux_sparc64 = target.target_os == "linux"
+                       && target.arch == "sparc64"
+                       && target.target_env == "gnu";
         let rust_abi = match sig.abi {
             RustIntrinsic | PlatformIntrinsic | Rust | RustCall => true,
             _ => false
@@ -526,8 +529,9 @@ impl<'tcx> FnTypeExt<'tcx> for FnType<'tcx, Ty<'tcx>> {
             if arg.layout.is_zst() {
                 // For some forsaken reason, x86_64-pc-windows-gnu
                 // doesn't ignore zero-sized struct arguments.
-                // The same is true for s390x-unknown-linux-gnu.
-                if is_return || rust_abi || (!win_x64_gnu && !linux_s390x) {
+                // The same is true for s390x-unknown-linux-gnu
+                // and sparc64-unknown-linux-gnu.
+                if is_return || rust_abi || (!win_x64_gnu && !linux_s390x && !linux_sparc64) {
                     arg.mode = PassMode::Ignore;
                 }
             }