From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta016.useast.a.cloudfilter.net (omta016.useast.a.cloudfilter.net [34.195.253.207]) by sourceware.org (Postfix) with ESMTPS id DC83D3857C49 for ; Thu, 27 Aug 2020 21:24:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DC83D3857C49 Received: from cxr.smtp.a.cloudfilter.net ([10.0.17.210]) by cmsmtp with ESMTP id BMzikjGjyxItlBPNIkkC4C; Thu, 27 Aug 2020 21:24:00 +0000 Received: from thunder.sweets ([68.100.138.62]) by cmsmtp with ESMTPSA id BPNHkTXY7fN5RBPNHkEY4r; Thu, 27 Aug 2020 21:24:00 +0000 X-Authority-Analysis: v=2.4 cv=PpEt0yA3 c=1 sm=1 tr=0 ts=5f482470 a=3mkzfl4ircflX6G+lDqBYw==:117 a=3mkzfl4ircflX6G+lDqBYw==:17 a=y4yBn9ojGxQA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=OiFU0sxr_syaqbM9TwoA:9 a=wPNLvfGTeEIA:10 a=w6pPrbetMnV_A6FVnhAA:9 a=jARBqhljGnl1kaUo:21 a=_W_S_7VecoQA:10 Received: by thunder.sweets (Postfix, from userid 116) id D20F211A96; Thu, 27 Aug 2020 17:23:57 -0400 (EDT) Received: from [10.10.10.15] (thunder.sweets [10.10.10.15]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by thunder.sweets (Postfix) with ESMTPS id 7CEC011941 for ; Thu, 27 Aug 2020 17:23:57 -0400 (EDT) Message-ID: <5F48246C.6040402@cox.net> Date: Thu, 27 Aug 2020 17:23:56 -0400 From: Joe Buehler User-Agent: Thunderbird 1.5.0.12 (X11/20120201) MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: aarch64 inline asm / -fPIC problem X-CMAE-Envelope: MS4xfDAlpVMAOuC9rx/3wmJzsZnwoE8DWN9Zlffdx6IEfBlVkLUZuE045UzH07NF5Rm9l8uyRAPIVpDhuaXd50aUjieQY16uQkS2c1hvVHN8irZG1p4Ejggb cdtAbWOis8amg6uKmev3AHUfZkJ6W4nczgtTedqbsJlT4lV7JIFfQZ2bdRiUJae2HoA8KN+D6J8fdg== X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, HTML_MESSAGE, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2020 21:24:02 -0000 My (compiler test) program: int main() { __asm__ volatile(".8byte %0\n\t" : : "i" ("message %s\n")); return 0; } This compiles fine with gcc 4.3.3 MIPS using: gcc -S -fPIC temp.c It fails with gcc 7.3.0 aarch64. Output is: 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 Removing the -fPIC it will compile fine. The relevant section of the MIPS generated code looks like this: .rdata .align 2 $LC0: .ascii "message %s\012\000" .text .align 2 .globl main .ent main .type main, @function main: .set nomips16 .frame $fp,8,$31 # vars= 0, regs= 1/0, args= 0, gp= 0 .mask 0x40000000,-4 .fmask 0x00000000,0 addiu $sp,$sp,-8 sw $fp,4($sp) move $fp,$sp #APP # 4 "temp.c" 1 .8byte $LC0 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?) Any suggestions? Joe Buehler