From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by sourceware.org (Postfix) with ESMTPS id 023283858D20 for ; Fri, 3 Feb 2023 15:22:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 023283858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f178.google.com with SMTP id m13so5520298plx.13 for ; Fri, 03 Feb 2023 07:22:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+lldaXmwCujSkEMus7Yf3a8SoK75XgGqHVrE2jilAQY=; b=WMQK/nnWwHGJO7UzihDa0jdTIc0TL4M2ML6rozQKcLVHNXOh2XdhAu14TI/r+nNf2Q E730gBAEpd43HJVn2ncWOFHvf0DVT2CoCILghaSYmVTKrIjm0vYQ572XhEOpZOKgd34v HdWmiWNiw5qrzsfqrSavcjugwAFiJfAXDa8xWI2f9cd1Y/38cCIMVMtylPG7gdmDvrdC d4LYy23SoaqF+gTB0hwuTR+IiieAt7NH9vDXe1LbHhcz5XSIG8WYkUCghfuNPt/N3Upf ytmS+vryEkRJ0avAVQoD9DEQ0mde90FF2ZJrvDL3qDAXtkL5+3C7r3aKkNtgVqJRKJiH D1lg== X-Gm-Message-State: AO0yUKXNj7AZxGRqXMITj+Tgglu5fQ9TvEfF6KzyXmAhXuTgBe5JgzNW ssNd7Fm0jvlbwbhx7+H2l0xjyjJqaPRdW/3cEpY= X-Google-Smtp-Source: AK7set8JgpVrjo7xNnPI80zvXe4hfpc3CNcOQ8Osd0TFO59cWh25D/grfmhIRWK2qhKouX4pDBVKu06kA9+YH0gKGQA= X-Received: by 2002:a17:903:48f:b0:196:5688:f0c8 with SMTP id jj15-20020a170903048f00b001965688f0c8mr2504537plb.10.1675437742950; Fri, 03 Feb 2023 07:22:22 -0800 (PST) MIME-Version: 1.0 References: <20230203090544.2528175-1-yunqiang.su@cipunited.com> <90a55d73f1d33299969d2a72938e4534185b39cd.camel@xry111.site> In-Reply-To: <90a55d73f1d33299969d2a72938e4534185b39cd.camel@xry111.site> From: YunQiang Su Date: Fri, 3 Feb 2023 23:22:11 +0800 Message-ID: Subject: Re: [PATCH] MIPS: use arch_32/64 instead of default_mips_arch To: Xi Ruoyao Cc: Richard Sandiford , YunQiang Su , gcc-patches@gcc.gnu.org, macro@orcam.me.uk, jiaxun.yang@flygoat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,BODY_8BITS,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP 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: Xi Ruoyao via Gcc-patches =E4=BA=8E2023=E5=B9=B42= =E6=9C=883=E6=97=A5=E5=91=A8=E4=BA=94 22:35=E5=86=99=E9=81=93=EF=BC=9A > > 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. > > > > 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). Doing that is even > > useful in some cases. For example, MIPS4+O32 is a useful combination, > > even though MIPS4 is a 64-bit ISA. Same for Octeon3+O32, etc. > > > > So is the linker behaviour really correct? 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:~$ > 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 vers= ion. > This program has absolutely no warranty. > > So I'd consider the issue a GNU ld regression if it suddenly stops to > behave like this. Sorry, I made a mistake: r2 works well while r6 does not. root@bookworm-mips64r6el:~# gcc -mabi=3D32 -mips64r6 -O3 -c yy.c root@bookworm-mips64r6el:~# gcc -mabi=3D32 -mips32r6 -O3 -c xx.c root@bookworm-mips64r6el:~# gcc -shared -o xx.so yy.o xx.o /usr/bin/ld: yy.o: ABI is incompatible with that of the selected emulation /usr/bin/ld: failed to merge target specific data of file yy.o /usr/bin/ld: xx.o: ABI is incompatible with that of the selected emulation /usr/bin/ld: failed to merge target specific data of file xx.o collect2: error: ld returned 1 exit status So, it seems that I need to find what happens in gnu ld for r6. > -- > Xi Ruoyao > School of Aerospace Science and Technology, Xidian University