From: Fangrui Song <maskray@google.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org, "H.J. Lu" <hjl.tools@gmail.com>
Subject: Re: [PATCH v2 1/4] Add declare_object_symbol_alias for assembly codes (BZ #28128)
Date: Thu, 12 May 2022 09:52:20 -0700 [thread overview]
Message-ID: <20220512165220.cdiovt4d2zeyv5nv@google.com> (raw)
In-Reply-To: <20220512125931.523712-2-adhemerval.zanella@linaro.org>
On 2022-05-12, Adhemerval Zanella wrote:
>From: "H.J. Lu" <hjl.tools@gmail.com>
>
>There are 2 problems in:
>
> #define declare_symbol_alias(symbol, original, type, size) \
> declare_symbol_alias_1 (symbol, original, type, size)
> #ifdef __ASSEMBLER__
> # define declare_symbol_alias_1(symbol, original, type, size) \
> strong_alias (original, symbol); \
> .type C_SYMBOL_NAME (symbol), %##type; \
> .size C_SYMBOL_NAME (symbol), size
>
>1. .type and .size are substituted by arguments.
>2. %##type is expanded to "% type" due to the GCC bug:
>
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101613
>
>But assembler doesn't support "% type".
>
>Workaround BZ #28128 by
>
>1. Don't define declare_symbol_alias for assembly codes.
>2. Define declare_object_symbol_alias for assembly codes.
Interesting. clang -E can expand
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101613
correctly.
Reviewed-by: Fangrui Song <maskray@google.com>
>---
> include/libc-symbols.h | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
>diff --git a/include/libc-symbols.h b/include/libc-symbols.h
>index 662bd118b1..4bb3d8c7ba 100644
>--- a/include/libc-symbols.h
>+++ b/include/libc-symbols.h
>@@ -324,14 +324,16 @@ for linking")
> This is only necessary when defining something in assembly, or playing
> funny alias games where the size should be other than what the compiler
> thinks it is. */
>-#define declare_symbol_alias(symbol, original, type, size) \
>- declare_symbol_alias_1 (symbol, original, type, size)
> #ifdef __ASSEMBLER__
>-# define declare_symbol_alias_1(symbol, original, type, size) \
>- strong_alias (original, symbol); \
>- .type C_SYMBOL_NAME (symbol), %##type; \
>- .size C_SYMBOL_NAME (symbol), size
>+# define declare_object_symbol_alias(symbol, original, size) \
>+ declare_object_symbol_alias_1 (symbol, original, size)
>+# define declare_object_symbol_alias_1(symbol, original, s_size) \
>+ strong_alias (original, symbol) ASM_LINE_SEP \
>+ .type C_SYMBOL_NAME (symbol), %object ASM_LINE_SEP \
>+ .size C_SYMBOL_NAME (symbol), s_size ASM_LINE_SEP
> #else /* Not __ASSEMBLER__. */
>+# define declare_symbol_alias(symbol, original, type, size) \
>+ declare_symbol_alias_1 (symbol, original, type, size)
> # define declare_symbol_alias_1(symbol, original, type, size) \
> asm (".globl " __SYMBOL_PREFIX #symbol \
> "\n\t" declare_symbol_alias_1_alias (symbol, original) \
>--
>2.34.1
>
next prev parent reply other threads:[~2022-05-12 16:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-12 12:59 [PATCH v2 0/4] Remove fno_unit_at_a_time configure check Adhemerval Zanella
2022-05-12 12:59 ` [PATCH v2 1/4] Add declare_object_symbol_alias for assembly codes (BZ #28128) Adhemerval Zanella
2022-05-12 16:52 ` Fangrui Song [this message]
2022-05-12 12:59 ` [PATCH v2 2/4] stdio: Remove the usage of $(fno-unit-at-a-time) for errlist.c Adhemerval Zanella
2022-05-12 17:03 ` Fangrui Song
2022-05-12 20:03 ` Adhemerval Zanella
2022-05-12 12:59 ` [PATCH v2 3/4] stdio: Remove the usage of $(fno-unit-at-a-time) for siglist.c Adhemerval Zanella
2022-05-12 17:06 ` Fangrui Song
2022-05-12 20:04 ` Adhemerval Zanella
2022-05-12 12:59 ` [PATCH v2 4/4] Remove configure fno_unit_at_a_time Adhemerval Zanella
2022-05-12 17:07 ` Fangrui Song
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=20220512165220.cdiovt4d2zeyv5nv@google.com \
--to=maskray@google.com \
--cc=adhemerval.zanella@linaro.org \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
/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).