Skip to content

Commit 4f0edbd

Browse files
committed
Auto merge of #69263 - anyska:blacklist-powerpc-zst, r=nagisa
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).
2 parents e9bca51 + 162d727 commit 4f0edbd

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/librustc/ty/layout.rs

+15-7
Original file line numberDiff line numberDiff line change
@@ -2541,12 +2541,15 @@ where
25412541
};
25422542

25432543
let target = &cx.tcx().sess.target.target;
2544+
let target_env_gnu_like = matches!(&target.target_env[..], "gnu" | "musl");
25442545
let win_x64_gnu =
25452546
target.target_os == "windows" && target.arch == "x86_64" && target.target_env == "gnu";
2546-
let linux_s390x =
2547-
target.target_os == "linux" && target.arch == "s390x" && target.target_env == "gnu";
2548-
let linux_sparc64 =
2549-
target.target_os == "linux" && target.arch == "sparc64" && target.target_env == "gnu";
2547+
let linux_s390x_gnu_like =
2548+
target.target_os == "linux" && target.arch == "s390x" && target_env_gnu_like;
2549+
let linux_sparc64_gnu_like =
2550+
target.target_os == "linux" && target.arch == "sparc64" && target_env_gnu_like;
2551+
let linux_powerpc_gnu_like =
2552+
target.target_os == "linux" && target.arch == "powerpc" && target_env_gnu_like;
25502553
let rust_abi = match sig.abi {
25512554
RustIntrinsic | PlatformIntrinsic | Rust | RustCall => true,
25522555
_ => false,
@@ -2617,9 +2620,14 @@ where
26172620
if arg.layout.is_zst() {
26182621
// For some forsaken reason, x86_64-pc-windows-gnu
26192622
// doesn't ignore zero-sized struct arguments.
2620-
// The same is true for s390x-unknown-linux-gnu
2621-
// and sparc64-unknown-linux-gnu.
2622-
if is_return || rust_abi || (!win_x64_gnu && !linux_s390x && !linux_sparc64) {
2623+
// The same is true for {s390x,sparc64,powerpc}-unknown-linux-{gnu,musl}.
2624+
if is_return
2625+
|| rust_abi
2626+
|| (!win_x64_gnu
2627+
&& !linux_s390x_gnu_like
2628+
&& !linux_sparc64_gnu_like
2629+
&& !linux_powerpc_gnu_like)
2630+
{
26232631
arg.mode = PassMode::Ignore;
26242632
}
26252633
}

0 commit comments

Comments
 (0)