Skip to content

Commit

Permalink
Auto merge of #69263 - anyska:blacklist-powerpc-zst, r=nagisa
Browse files Browse the repository at this point in the history
Blacklist powerpc-unknown-linux-{gnu,musl} as having non-ignored GNU C ZSTs.

Ref #64259 (this is a simpler alternative to that). See also #64259 (comment).
  • Loading branch information
bors committed Feb 29, 2020
2 parents e9bca51 + 162d727 commit 4f0edbd
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2541,12 +2541,15 @@ where
};

let target = &cx.tcx().sess.target.target;
let target_env_gnu_like = matches!(&target.target_env[..], "gnu" | "musl");
let win_x64_gnu =
target.target_os == "windows" && target.arch == "x86_64" && target.target_env == "gnu";
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 linux_s390x_gnu_like =
target.target_os == "linux" && target.arch == "s390x" && target_env_gnu_like;
let linux_sparc64_gnu_like =
target.target_os == "linux" && target.arch == "sparc64" && target_env_gnu_like;
let linux_powerpc_gnu_like =
target.target_os == "linux" && target.arch == "powerpc" && target_env_gnu_like;
let rust_abi = match sig.abi {
RustIntrinsic | PlatformIntrinsic | Rust | RustCall => true,
_ => false,
Expand Down Expand Up @@ -2617,9 +2620,14 @@ where
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
// and sparc64-unknown-linux-gnu.
if is_return || rust_abi || (!win_x64_gnu && !linux_s390x && !linux_sparc64) {
// The same is true for {s390x,sparc64,powerpc}-unknown-linux-{gnu,musl}.
if is_return
|| rust_abi
|| (!win_x64_gnu
&& !linux_s390x_gnu_like
&& !linux_sparc64_gnu_like
&& !linux_powerpc_gnu_like)
{
arg.mode = PassMode::Ignore;
}
}
Expand Down

0 comments on commit 4f0edbd

Please sign in to comment.