From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [89.208.246.23]) by sourceware.org (Postfix) with ESMTPS id 99F8D3858D20 for ; Fri, 3 Feb 2023 14:34:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99F8D3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1675434870; bh=vaEnUsfcnaP/iecWTdbzyxYpCEmCiHhBG0BjoXrdIYo=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=nVpECD0MMYHWw+1JmEQENy5wdEiO32km7uzpqdj2OvR0FSmg/yy2kY7LK9s/BZi70 Z3fEkz/BREhFmYxvutZQxnVkSJdUGrWmVn+FvzAtUbWRY6XirNTYGlMsER1NBxbBVO mG1aeDoVsF+jscw76Ar3Nxke10hvOOjmKXooOC5M= Received: from localhost.localdomain (xry111.site [IPv6:2001:470:683e::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 34D5C6681C; Fri, 3 Feb 2023 09:34:29 -0500 (EST) Message-ID: <90a55d73f1d33299969d2a72938e4534185b39cd.camel@xry111.site> Subject: Re: [PATCH] MIPS: use arch_32/64 instead of default_mips_arch From: Xi Ruoyao To: Richard Sandiford , YunQiang Su Cc: YunQiang Su , gcc-patches@gcc.gnu.org, macro@orcam.me.uk, jiaxun.yang@flygoat.com Date: Fri, 03 Feb 2023 22:34:27 +0800 In-Reply-To: References: <20230203090544.2528175-1-yunqiang.su@cipunited.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.3 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD,LIKELY_SPAM_FROM,SPF_HELO_PASS,SPF_PASS,TXREP,T_PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 2023-02-03 at 14:08 +0000, Richard Sandiford via Gcc-patches wrote: > > Do you mean that the "wrong" format is quite interesting? > > Yes, While this format is never used at all. >=20 > My point was that there is nothing wrong in principle with creating > an o32 executable that has a 64-bit rather than a 32-bit ISA (since > the > 64-bit ISAs are pure extensions of 32-bit ISAs).=C2=A0 Doing that is even > useful in some cases.=C2=A0 For example, MIPS4+O32 is a useful combinatio= n, > even though MIPS4 is a 64-bit ISA.=C2=A0 Same for Octeon3+O32, etc. >=20 > So is the linker behaviour really correct?=C2=A0 Doesn't it mean that > Octeon3 O32 binaries are link-incompatible with MIPS32 o32 binaries? On gcc230: xry111@gcc230:~$ cat a.c int a() { return 42; } xry111@gcc230:~$ cat b.c extern int a(void); int main() { return a() ^ 42; } xry111@gcc230:~$ cc a.c -mabi=3D32 -march=3Dmips32r2 -c xry111@gcc230:~$ cc b.c -mabi=3D32 -march=3Dmips64r2 -c xry111@gcc230:~$ cc a.o b.o xry111@gcc230:~$ ./a.out && echo ok ok xry111@gcc230:~$=20 xry111@gcc230:~$ ld -version GNU ld (GNU Binutils for Debian) 2.31.1 Copyright (C) 2018 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later versio= n. This program has absolutely no warranty. So I'd consider the issue a GNU ld regression if it suddenly stops to behave like this. --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University