From patchwork Tue Dec 21 13:25:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Buclaw X-Patchwork-Id: 49146 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 25EFF3858400 for ; Tue, 21 Dec 2021 13:26:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25EFF3858400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1640093195; bh=fxG0Xo1bjwIAFfs9NiCrgJJxAh5CKuct+ydmxbyh15A=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=hl80n2riPExnt69jzuQRDTdcaY+h7oK//SNmdBW1uf3PleCvoFYaSF/E2gQtNgA7U 3sDeEobkilgLceCHPLgHI0p9+lg58z5qX1CUjd7buM2npa4VdQ3TeWhSmrdc2HF0G9 p1wETgEJ332LFlcvo8Z+Lw3BD01VM0g6SGLi9Qr0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [IPv6:2001:67c:2050::465:102]) by sourceware.org (Postfix) with ESMTPS id 7628F3858C2C for ; Tue, 21 Dec 2021 13:26:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7628F3858C2C Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4JJHK64mZfzQjgF; Tue, 21 Dec 2021 14:26:02 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de To: gcc-patches@gcc.gnu.org Subject: [GCC-9, 10, 11][committed] libphobos: Fix definition of stat_t for MIPS64 (PR103604) Date: Tue, 21 Dec 2021 14:25:57 +0100 Message-Id: <20211221132557.2828206-1-ibuclaw@gdcproject.org> MIME-Version: 1.0 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Buclaw via Gcc-patches From: Iain Buclaw Reply-To: Iain Buclaw Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, This patch backports a specific change from commit r12-6003 to the release branches to fix the layout of stat_t on MIPS64 targets. Bootstrapped and regression tested on mips-unknown-linux, with -mabi=64 and -mabi=n32 multilib configurations. Committed to releases/gcc-11, gcc-10, and gcc-9 branches. Regards Iain. --- libphobos/ChangeLog: PR d/103604 * libdruntime/core/sys/posix/sys/stat.d (struct stat_t): Fix definition for MIPS64. --- .../libdruntime/core/sys/posix/sys/stat.d | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d index 6b4d022b825..7d0b1708e2d 100644 --- a/libphobos/libdruntime/core/sys/posix/sys/stat.d +++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d @@ -340,26 +340,23 @@ version (CRuntime_Glibc) } c_long[14] st_pad5; } + static if (!__USE_FILE_OFFSET64) + static assert(stat_t.sizeof == 144); + else + static assert(stat_t.sizeof == 160); } else version (MIPS64) { struct stat_t { - c_ulong st_dev; + dev_t st_dev; int[3] st_pad1; - static if (!__USE_FILE_OFFSET64) - { - ino_t st_ino; - } - else - { - c_ulong st_ino; - } + ino_t st_ino; mode_t st_mode; nlink_t st_nlink; uid_t st_uid; gid_t st_gid; - c_ulong st_rdev; + dev_t st_rdev; static if (!__USE_FILE_OFFSET64) { uint[2] st_pad2; @@ -368,8 +365,8 @@ version (CRuntime_Glibc) } else { - c_long[3] st_pad2; - c_long st_size; + uint[3] st_pad2; + off_t st_size; } static if (__USE_MISC || __USE_XOPEN2K8) { @@ -394,15 +391,26 @@ version (CRuntime_Glibc) } blksize_t st_blksize; uint st_pad4; + blkcnt_t st_blocks; + int[14] st_pad5; + } + version (MIPS_N32) + { static if (!__USE_FILE_OFFSET64) - { - blkcnt_t st_blocks; - } + static assert(stat_t.sizeof == 160); else - { - c_long st_blocks; - } - c_long[14] st_pad5; + static assert(stat_t.sizeof == 176); + } + else version (MIPS_O64) + { + static if (!__USE_FILE_OFFSET64) + static assert(stat_t.sizeof == 160); + else + static assert(stat_t.sizeof == 176); + } + else + { + static assert(stat_t.sizeof == 216); } } else version (PPC)