From: YunQiang Su <yunqiang.su@cipunited.com>
To: binutils@sourceware.org
Cc: syq@debian.org, macro@orcam.me.uk, xry111@xry111.site,
richard.sandiford@arm.com, jiaxun.yang@flygoat.com,
YunQiang Su <yunqiang.su@cipunited.com>
Subject: [PATCH] MIPS: gas: alter 64 or 32 for r6 triples if march is implicit
Date: Sat, 6 May 2023 16:37:18 +0800 [thread overview]
Message-ID: <20230506083718.3669965-1-yunqiang.su@cipunited.com> (raw)
When configure with triples mipsisa[32,64]r6[el,], the march value
is pinned to a fix value if not given explicitly. for example
mipsisa32r6-linux-gnu -n32 xx.s
will complains that:
-march=mips32r6 is not compatible with the selected ABI
Since we are using these triples as a regular linux distributions,
let's alter march according to ABI.
---
gas/config/tc-mips.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 8a970ceada2..d99736df26a 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -20247,6 +20247,24 @@ mips_parse_cpu (const char *option, const char *cpu_string)
: ISA_MIPS1);
}
+ /* mipsisa32r6-linux-gnu refuses -n32/-64 swtiches:
+ -march=mips32r6 is not compatible with the selected ABI
+ Let's workaround it when -march options are not given explicitly.
+ We treat it some like -march=from-abi */
+ if ((strcasecmp (cpu_string, "mips32r6") == 0 || strcasecmp (cpu_string, "mips64r6") == 0)
+ && strcasecmp (option, "default CPU") == 0)
+ {
+ if (ABI_NEEDS_32BIT_REGS (mips_abi))
+ return mips_cpu_info_from_isa (ISA_MIPS32R6);
+
+ if (ABI_NEEDS_64BIT_REGS (mips_abi))
+ return mips_cpu_info_from_isa (ISA_MIPS64R6);
+
+ if (file_mips_opts.gp >= 0)
+ return mips_cpu_info_from_isa (file_mips_opts.gp == 32
+ ? ISA_MIPS32R6 : ISA_MIPS64R6);
+ }
+
/* 'default' has traditionally been a no-op. Probably not very useful. */
if (strcasecmp (cpu_string, "default") == 0)
return 0;
--
2.30.2
next reply other threads:[~2023-05-06 8:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-06 8:37 YunQiang Su [this message]
2023-05-06 8:42 ` Jiaxun Yang
2023-05-06 8:52 ` YunQiang Su
2023-05-06 9:15 ` Jiaxun Yang
2023-05-07 18:17 ` Maciej W. Rozycki
2023-05-07 18:34 ` Jiaxun Yang
2023-05-07 19:01 ` Maciej W. Rozycki
2023-05-08 9:16 ` YunQiang Su
2023-05-08 12:25 ` Maciej W. Rozycki
2023-05-08 13:00 ` YunQiang Su
2023-05-08 14:43 ` Maciej W. Rozycki
2023-05-08 19:06 ` Maciej W. Rozycki
2023-05-09 3:16 ` YunQiang Su
2023-05-09 7:58 ` Richard Sandiford
2023-05-08 9:18 ` YunQiang Su
2023-05-08 9:39 ` Andreas Schwab
2023-05-08 10:51 ` YunQiang Su
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=20230506083718.3669965-1-yunqiang.su@cipunited.com \
--to=yunqiang.su@cipunited.com \
--cc=binutils@sourceware.org \
--cc=jiaxun.yang@flygoat.com \
--cc=macro@orcam.me.uk \
--cc=richard.sandiford@arm.com \
--cc=syq@debian.org \
--cc=xry111@xry111.site \
/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).