aarch64 inline asm / -fPIC problem

Joe Buehler aspam@cox.net
Wed Sep 2 18:26:03 GMT 2020


Andrew Haley wrote:
> On 27/08/2020 22:23, Joe Buehler via Gcc-help wrote:
> 
>     temp.c: In function  main :
>     temp.c:4:2: warning: asm operand 0 probably doesn t match constraints
>       __asm__ volatile(".8byte %0\n\t" : : "i" ("message %s\n"));
>       ^~~~~~~
>     temp.c:4:2: error: impossible constraint in  asm
> 
> I'd use the "S" constraint.

Thanks that worked.

> 
>> I am unable to code something similar manually using inline asm because
>> the string is a format string containing % characters, which inline asm
>> will of course try to interpret. (Does gcc provide anything to escape %
>> chars in a literal string?)
> 
> "%%"
> 

The problem is that I have literal printf format strings in a multiplatform code base.  I need something like a gcc builtin to do the % doubling.

#define X(fmt) asm ("lines " __builtin_escape(fmt) " more lines")

Joe Buehler


More information about the Gcc-help mailing list