public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: YunQiang Su <syq@debian.org>
To: Xi Ruoyao <xry111@xry111.site>
Cc: Richard Sandiford <richard.sandiford@arm.com>,
	YunQiang Su <yunqiang.su@cipunited.com>,
	 gcc-patches@gcc.gnu.org, macro@orcam.me.uk,
	jiaxun.yang@flygoat.com
Subject: Re: [PATCH] MIPS: use arch_32/64 instead of default_mips_arch
Date: Fri, 3 Feb 2023 23:22:11 +0800	[thread overview]
Message-ID: <CAKcpw6VA92Ls-qWUXRhVnVzQp+WaMYYKHFkn5gXyfyC3eVNrLw@mail.gmail.com> (raw)
In-Reply-To: <90a55d73f1d33299969d2a72938e4534185b39cd.camel@xry111.site>

Xi Ruoyao via Gcc-patches <gcc-patches@gcc.gnu.org> 于2023年2月3日周五 22:35写道:
>
> 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=32 -march=mips32r2 -c
> xry111@gcc230:~$ cc b.c -mabi=32 -march=mips64r2 -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 version.
> 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=32 -mips64r6 -O3 -c yy.c
root@bookworm-mips64r6el:~# gcc -mabi=32 -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 <xry111@xry111.site>
> School of Aerospace Science and Technology, Xidian University

      reply	other threads:[~2023-02-03 15:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03  9:05 YunQiang Su
2023-02-03 12:28 ` Richard Sandiford
2023-02-03 13:23   ` YunQiang Su
2023-02-03 14:08     ` Richard Sandiford
2023-02-03 14:34       ` Xi Ruoyao
2023-02-03 15:22         ` YunQiang Su [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKcpw6VA92Ls-qWUXRhVnVzQp+WaMYYKHFkn5gXyfyC3eVNrLw@mail.gmail.com \
    --to=syq@debian.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=macro@orcam.me.uk \
    --cc=richard.sandiford@arm.com \
    --cc=xry111@xry111.site \
    --cc=yunqiang.su@cipunited.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).