On 02/03/2026 14:02, Jakub Jelinek wrote:
> On Mon, Mar 02, 2026 at 02:39:39PM +0100, Torbjörn SVENSSON wrote:
>> Changes since v1:
>>
>> - Adjust the inline assembler to also work for Cortex-M.
>> - Droped dg-skip-if.
>>
>> Tested on top of r16-7367-g7b2e9d01d325f0 for arm-none-eabi and 
>> x86_64-pc-linux-gnu with success.
>>
>> Ok for trunk?
>>
>> --
>>
>> gcc/testsuite/ChangeLog:
>>
>>      PR testsuite/124320
>>      * gcc.dg/lto/toplevel-extended-asm-1_0.c: Adjust inline
>>      assembler for arm-none-eabi.
> 
> This is wrong.
> You shouldn't provide two separate inline asms that claim
> to define the same function, it will cause havoc with cgraph/LTO etc.
> For #ifdef __ELF__, you should simply add that .type directive to the
> asm templates of the existing inline asms.
> 
> Also, not sure if the second operand (i.e. function without @ or % in
> front of it) is accepted by all ELF assemblers.
> 
> config/aarch64/aarch64-elf.h:#undef TYPE_OPERAND_FMT
> config/aarch64/aarch64-elf.h:#define TYPE_OPERAND_FMT   "%%%s"
> config/arc/arc.h:#undef  TYPE_OPERAND_FMT
> config/arc/arc.h:#define TYPE_OPERAND_FMT       "@%s"
> config/arm/elf.h:   TYPE_OPERAND_FMT.  */
> config/arm/elf.h:#undef  TYPE_OPERAND_FMT
> config/arm/elf.h:#define TYPE_OPERAND_FMT       "%%%s"
> config/elfos.h:#define TYPE_OPERAND_FMT "@%s"
> config/microblaze/microblaze.h:#define TYPE_OPERAND_FMT         "@%s"
> config/microblaze/microblaze.h:    fprintf (FILE, TYPE_OPERAND_FMT, 
> "object");                          \
> config/openbsd.h:#undef TYPE_OPERAND_FMT
> config/openbsd.h:#define TYPE_OPERAND_FMT       "@%s"
> config/pa/pa64-hpux.h:  fprintf (STREAM, TYPE_OPERAND_FMT, TYPE);             
>           \
> config/rx/linux.h:      fprintf (STREAM, TYPE_OPERAND_FMT, TYPE);             
>                   \
> config/rx/rx.h:      fprintf (STREAM, TYPE_OPERAND_FMT, TYPE);                
>           \
> config/sparc/sysv4.h:#undef TYPE_OPERAND_FMT
> config/sparc/sysv4.h:#define TYPE_OPERAND_FMT      "#%s"
> 
>       Jakub
> 

gas for some time now has implemented the prefix char in .type as

  if (   *input_line_pointer == '#'
      || *input_line_pointer == '@'
      || *input_line_pointer == '"'
      || *input_line_pointer == '%')
    ++input_line_pointer;

That is, it just skips it if there.  Do we still use any ELF assemblers other 
than gas?

R.

Reply via email to