diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2018-12-24 13:29:37 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-24 13:29:37 +0100 |
| commit | 6ce748ac381d8faf83725eb179640e3ab89835ed (patch) | |
| tree | ef2f9e32d0738813c1a64f489ba1b528b14b77c6 | |
| parent | 8b0b70d3273cd6185ec384f6f6ba01ec328b0929 (diff) | |
| parent | 65dabd6eaf24bbf3b7069a51984411aea2864856 (diff) | |
| download | rust-6ce748ac381d8faf83725eb179640e3ab89835ed.tar.gz rust-6ce748ac381d8faf83725eb179640e3ab89835ed.zip | |
Rollup merge of #57085 - glaubitz:sparc64-abi-fix, r=nagisa
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.
| -rw-r--r-- | src/librustc_codegen_llvm/abi.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index 71b75525a5a..8c4f7a58dab 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 @@ -520,8 +523,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; } } |
