[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#904703: rustc: Please backport another sparc64 CABI fix



Source: rustc
Version: 1.27.2+dfsg1-1
Severity: normal
Tags: patch
User: debian-sparc@lists.debian.org
Usertags: sparc64

Hello!

Rust upstream just fixed another bug in the sparc64 CABI [1]
which can result in miscompiled code. Since the patch is rather
trivial and affects sparc64 only, it would be good if we could
include it in the next upload.

Attaching the patch from upstream.

Thanks,
Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
>From 051eddd9a9067dcbdccef6bfd86301453bae42ad Mon Sep 17 00:00:00 2001
From: Petr Sumbera <petr.sumbera@oracle.com>
Date: Thu, 26 Jul 2018 03:58:00 -0700
Subject: [PATCH] sparc ABI issue - structure returning from function is
 returned in 64bit registers

Fixes: #52638
---
 src/librustc_target/abi/call/sparc64.rs | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/librustc_target/abi/call/sparc64.rs b/src/librustc_target/abi/call/sparc64.rs
index 987f56e6f985..a58aebc2ff06 100644
--- a/src/librustc_target/abi/call/sparc64.rs
+++ b/src/librustc_target/abi/call/sparc64.rs
@@ -57,16 +57,7 @@ fn classify_ret_ty<'a, Ty, C>(cx: C, ret: &mut ArgType<'a, Ty>)
     let size = ret.layout.size;
     let bits = size.bits();
     if bits <= 256 {
-        let unit = if bits <= 8 {
-            Reg::i8()
-        } else if bits <= 16 {
-            Reg::i16()
-        } else if bits <= 32 {
-            Reg::i32()
-        } else {
-            Reg::i64()
-        };
-
+        let unit = Reg::i64();
         ret.cast_to(Uniform {
             unit,
             total: size


Reply to: