public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] Add declare_object_symbol_alias for assembly codes (BZ #28128)
@ 2022-05-12 19:28 Adhemerval Zanella
  0 siblings, 0 replies; 3+ messages in thread
From: Adhemerval Zanella @ 2022-05-12 19:28 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b83db18c5da54c632618fe6a3fed52297f3a8d57

commit b83db18c5da54c632618fe6a3fed52297f3a8d57
Author: H.J. Lu <hjl.tools@gmail.com>
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.

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) \


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [glibc/azanella/clang] Add declare_object_symbol_alias for assembly codes (BZ #28128)
@ 2022-05-10 18:18 Adhemerval Zanella
  0 siblings, 0 replies; 3+ messages in thread
From: Adhemerval Zanella @ 2022-05-10 18:18 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0c661d639405a0a2c68f36fa0bbe53fd9b7c1d1d

commit 0c661d639405a0a2c68f36fa0bbe53fd9b7c1d1d
Author: H.J. Lu <hjl.tools@gmail.com>
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.

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) \


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [glibc/azanella/clang] Add declare_object_symbol_alias for assembly codes (BZ #28128)
@ 2022-04-29 13:58 Adhemerval Zanella
  0 siblings, 0 replies; 3+ messages in thread
From: Adhemerval Zanella @ 2022-04-29 13:58 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1f02cbc23601aeac55a92fa978b55846a54efda3

commit 1f02cbc23601aeac55a92fa978b55846a54efda3
Author: H.J. Lu <hjl.tools@gmail.com>
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.

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) \


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-12 19:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 19:28 [glibc/azanella/clang] Add declare_object_symbol_alias for assembly codes (BZ #28128) Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2022-05-10 18:18 Adhemerval Zanella
2022-04-29 13:58 Adhemerval Zanella

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).