On 02/03/2026 18:15, Torbjorn SVENSSON wrote:
>
>
> On 2026-03-02 15:42, Jakub Jelinek wrote:
>> On Mon, Mar 02, 2026 at 02:21:44PM +0000, Richard Earnshaw (foss) wrote:
>>> 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?
>>
>> At least Solaris assembler and LLVM assembler (the latter form gcn target).
>
>
> Would this be a better block?
>
> #ifdef __ELF__
> asm(".global %cc0\n\t.type %cc0, %%function\n%cc0:" :: ":" (asm_fn));
> asm(".global %cc0\n\t.type %cc0, %%function\n%cc0:" :: ":" (asm_fn_used));
> #else
> asm(".global %cc0\n%cc0:" :: ":" (asm_fn));
> asm(".global %cc0\n%cc0:" :: ":" (asm_fn_used));
> #endif
>
>
> I used % as that's what apparently is generated by GCC for arm-none-eabi.
> For x86_64-pc-linux-gnu, @ is instead used.
>
> I don't know if this will cause any problems for other targets...
>
I expect the problem to be non-gas assemblers. Specifically Sparc/solaris.
I'd code this as minimally as possible, perhaps something like
#ifdef __ELF__
#ifdef __sparc__ // For Solaris assembler -- Check spelling (of __sparc__)
here
#define TYPE_PFX "@"
#else
#define TYPE_PFX "%%"
#endif
asm(".global %cc0\n\t.type %cc0, " TYPE_PFX "function\n%cc0:" :: ":" (asm_fn));
asm(".global %cc0\n\t.type %cc0, " TYPE_PFX "function\n%cc0:" :: ":"
(asm_fn_used));
#else
asm(".global %cc0\n%cc0:" :: ":" (asm_fn));
asm(".global %cc0\n%cc0:" :: ":" (asm_fn_used));
#endif
We can add additional architectures if needed, but any using gas should be fine
with this.
R.
> Kind regards,
> Torbjörn