From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 63666395C04A; Fri, 13 May 2022 14:08:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63666395C04A Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] Add declare_object_symbol_alias for assembly codes (BZ #28128) X-Act-Checkin: glibc X-Git-Author: H.J. Lu X-Git-Refname: refs/heads/master X-Git-Oldrev: 9bcd12d223a8990254b65e2dada54faa5d2742f3 X-Git-Newrev: 111254f3e1e1a7ae5c2eda7cebc98f93a61d417c Message-Id: <20220513140842.63666395C04A@sourceware.org> Date: Fri, 13 May 2022 14:08:42 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2022 14:08:42 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=111254f3e1e1a7ae5c2eda7cebc98f93a61d417c commit 111254f3e1e1a7ae5c2eda7cebc98f93a61d417c Author: H.J. Lu Date: Wed Apr 6 10:06:37 2022 -0300 Add declare_object_symbol_alias for assembly codes (BZ #28128) 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. Reviewed-by: Fangrui Song Diff: --- 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) \