public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug build/28128] New: declare_symbol_alias doesn't work for assembly codes
@ 2021-07-24  1:09 hjl.tools at gmail dot com
  2021-07-24  6:25 ` [Bug build/28128] " schwab@linux-m68k.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2021-07-24  1:09 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28128

            Bug ID: 28128
           Summary: declare_symbol_alias doesn't work for assembly codes
           Product: glibc
           Version: 2.34
            Status: NEW
          Severity: normal
          Priority: P2
         Component: build
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
                CC: carlos at redhat dot com
  Target Milestone: ---

#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

There are 2 problems:

1. .type and .size are substituted by arguments.
2. %##type generates "% type" since % isn't valid char for symbol.
But assembler doesn't support "% type":

[hjl@gnu-cfl-2 tmp]$ cat x.s
        .data
_r_gnu_debug:
        .zero 56

.globl _r_debug
.set _r_debug,_r_gnu_debug
.type _r_debug, % object
.size _r_debug, 40;
[hjl@gnu-cfl-2 tmp]$ gcc -c x.s
x.s: Assembler messages:
x.s:7: Error: unrecognized symbol type ""
x.s:7: Error: junk at end of line, first unrecognized character is `o'

[hjl@gnu-cfl-2 tmp]$ cat x.s 
        .data
_r_gnu_debug:
        .zero 56

.globl _r_debug
.set _r_debug,_r_gnu_debug
.type _r_debug, %object
.size _r_debug, 40;
[hjl@gnu-cfl-2 tmp]$ gcc -c x.s
[hjl@gnu-cfl-2 tmp]$

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28128] declare_symbol_alias doesn't work for assembly codes
  2021-07-24  1:09 [Bug build/28128] New: declare_symbol_alias doesn't work for assembly codes hjl.tools at gmail dot com
@ 2021-07-24  6:25 ` schwab@linux-m68k.org
  2021-07-24 12:56 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: schwab@linux-m68k.org @ 2021-07-24  6:25 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28128

--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
(In reply to H.J. Lu from comment #0)
> 2. %##type generates "% type" since % isn't valid char for symbol.

This is a gcc bug.  In the assembler-with-cpp dialect there should not be a
space.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28128] declare_symbol_alias doesn't work for assembly codes
  2021-07-24  1:09 [Bug build/28128] New: declare_symbol_alias doesn't work for assembly codes hjl.tools at gmail dot com
  2021-07-24  6:25 ` [Bug build/28128] " schwab@linux-m68k.org
@ 2021-07-24 12:56 ` hjl.tools at gmail dot com
  2022-05-13 14:08 ` cvs-commit at gcc dot gnu.org
  2022-05-13 14:12 ` adhemerval.zanella at linaro dot org
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2021-07-24 12:56 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28128

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=101613

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
I opened a GCC bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101613

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28128] declare_symbol_alias doesn't work for assembly codes
  2021-07-24  1:09 [Bug build/28128] New: declare_symbol_alias doesn't work for assembly codes hjl.tools at gmail dot com
  2021-07-24  6:25 ` [Bug build/28128] " schwab@linux-m68k.org
  2021-07-24 12:56 ` hjl.tools at gmail dot com
@ 2022-05-13 14:08 ` cvs-commit at gcc dot gnu.org
  2022-05-13 14:12 ` adhemerval.zanella at linaro dot org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-13 14:08 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28128

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Adhemerval Zanella
<azanella@sourceware.org>:

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

commit 111254f3e1e1a7ae5c2eda7cebc98f93a61d417c
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.

    Reviewed-by: Fangrui Song <maskray@google.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug build/28128] declare_symbol_alias doesn't work for assembly codes
  2021-07-24  1:09 [Bug build/28128] New: declare_symbol_alias doesn't work for assembly codes hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2022-05-13 14:08 ` cvs-commit at gcc dot gnu.org
@ 2022-05-13 14:12 ` adhemerval.zanella at linaro dot org
  3 siblings, 0 replies; 5+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2022-05-13 14:12 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28128

Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |2.36
             Status|NEW                         |RESOLVED
                 CC|                            |adhemerval.zanella at linaro dot o
                   |                            |rg
         Resolution|---                         |FIXED

--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Fixed on 2.36;

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-24  1:09 [Bug build/28128] New: declare_symbol_alias doesn't work for assembly codes hjl.tools at gmail dot com
2021-07-24  6:25 ` [Bug build/28128] " schwab@linux-m68k.org
2021-07-24 12:56 ` hjl.tools at gmail dot com
2022-05-13 14:08 ` cvs-commit at gcc dot gnu.org
2022-05-13 14:12 ` adhemerval.zanella at linaro dot org

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