-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #52734 - nagisa:sparcfix, r=oli-obk
sparc ABI issue - structure returning from function is returned in 64bit registers (with tests) Fixes #52638 Supersedes #52730 cc @psumbera
- Loading branch information
Showing
2 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
// | ||
// Checks that we correctly codegen extern "C" functions returning structs. | ||
// See issue #52638. | ||
|
||
// compile-flags: -O --target=sparc64-unknown-linux-gnu --crate-type=rlib | ||
#![feature(no_core, lang_items)] | ||
#![no_core] | ||
|
||
#[lang="sized"] | ||
trait Sized { } | ||
#[lang="freeze"] | ||
trait Freeze { } | ||
#[lang="copy"] | ||
trait Copy { } | ||
|
||
#[repr(C)] | ||
pub struct Bool { | ||
b: bool, | ||
} | ||
|
||
// CHECK: define i64 @structbool() | ||
// CHECK-NEXT: start: | ||
// CHECK-NEXT: ret i64 72057594037927936 | ||
#[no_mangle] | ||
pub extern "C" fn structbool() -> Bool { | ||
Bool { b: true } | ||
} |