public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joe Buehler <aspam@cox.net>
To: Andrew Haley <aph@redhat.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: aarch64 inline asm / -fPIC problem
Date: Wed, 02 Sep 2020 14:26:03 -0400	[thread overview]
Message-ID: <5F4FE3BB.6020208@cox.net> (raw)
In-Reply-To: <8dff32c6-4e2c-2a1a-4216-98951f52b552@redhat.com>

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

      parent reply	other threads:[~2020-09-02 18:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 21:23 Joe Buehler
2020-08-28 13:45 ` Joe Buehler
2020-08-28 15:17   ` Joe Buehler
2020-08-29 15:45 ` Andrew Haley
2020-09-02 18:25   ` aph@redhat.com Joe Buehler
2020-09-03 10:18     ` aph@redhat.com Andrew Haley
2020-09-02 18:26   ` Joe Buehler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5F4FE3BB.6020208@cox.net \
    --to=aspam@cox.net \
    --cc=aph@redhat.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).