From: YunQiang Su <syq@gcc.gnu.org>
To: nickc@redhat.com
Cc: binutils@sourceware.org, macro@orcam.me.uk, xry111@xry111.site
Subject: [PATCH] MIPS/Gas: Support .L/$ as the mark of local symbol
Date: Mon, 5 Feb 2024 18:14:27 +0800 [thread overview]
Message-ID: <20240205101427.2862503-1-syq@gcc.gnu.org> (raw)
In as.texi, there are lines:
A local symbol is any symbol beginning with certain local
label prefixes. By default, the local label prefix is
@samp{.L} for ELF systems or @samp{L} for traditional a.out
systems, but each target may have its own set of local
label prefixes.
Let's support it for MIPS:
1) For OldABI, GCC uses "$" to mark local symbols, and
for NewABI, ".L" is used. So let's support both for
OldABI, and ".L" only for NewABI.
2) Emit an fatal error, if a local symbol is used, while
not defined, just like LLVM does.
---
gas/config/tc-mips.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 43c12de2c8a..a84b13e1815 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -17725,6 +17725,16 @@ pic_need_relax (symbolS *sym)
if (symbol_section_p (sym))
return true;
+ if (strstr (S_GET_NAME (sym), ".L") == S_GET_NAME (sym)
+ || ((mips_abi == O64_ABI || mips_abi == O32_ABI)
+ && strstr (S_GET_NAME (sym), "$") == S_GET_NAME (sym)))
+ {
+ if (!S_IS_DEFINED (sym))
+ as_fatal (_("undefined temporary symbol: %s"),
+ S_GET_NAME (sym));
+ return true;
+ }
+
symsec = S_GET_SEGMENT (sym);
/* This must duplicate the test in adjust_reloc_syms. */
--
2.39.2
next reply other threads:[~2024-02-05 10:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 10:14 YunQiang Su [this message]
2024-02-21 8:50 ` YunQiang Su
2024-02-21 13:32 ` Maciej W. Rozycki
2024-02-21 14:09 ` YunQiang Su
2024-02-21 14:47 ` Maciej W. Rozycki
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=20240205101427.2862503-1-syq@gcc.gnu.org \
--to=syq@gcc.gnu.org \
--cc=binutils@sourceware.org \
--cc=macro@orcam.me.uk \
--cc=nickc@redhat.com \
--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).