From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28906 invoked by alias); 21 Sep 2005 14:57:06 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 28604 invoked by uid 22791); 21 Sep 2005 14:56:33 -0000 Received: from pecan.ugent.be (HELO pecan.UGent.be) (157.193.49.18) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Wed, 21 Sep 2005 14:56:33 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by pecan.UGent.be (Postfix) with ESMTP id AEAE23525FB for ; Wed, 21 Sep 2005 16:56:31 +0200 (CEST) Received: from pecan.UGent.be ([127.0.0.1]) by localhost (gorilla.UGent.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21345-05 for ; Wed, 21 Sep 2005 16:56:28 +0200 (CEST) Received: from mail.elis.UGent.be (mail.elis.UGent.be [157.193.206.48]) by pecan.UGent.be (Postfix) with ESMTP id 2C0213525F6 for ; Wed, 21 Sep 2005 16:56:28 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.elis.UGent.be (Postfix) with ESMTP id A48F02BAD65 for ; Wed, 21 Sep 2005 16:56:27 +0200 (CEST) Received: from [157.193.205.191] (faramir.elis.UGent.be [157.193.205.191]) by mail.elis.UGent.be (Postfix) with ESMTP id 9D8CF2BAD63 for ; Wed, 21 Sep 2005 16:56:27 +0200 (CEST) Message-ID: <43317509.9010902@elis.ugent.be> Date: Wed, 21 Sep 2005 14:57:00 -0000 From: Ludo Van Put User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: specs parser changed? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-09/txt/msg00141.txt.bz2 We need to distinguish between handwritten assembler and compiled code in order to make assumptions on the behaviour of the code in our link-time optimizer (http://www.elis.ugent.be/diablo). We want to know if a certain piece of code adheres to calling conventions etc. In the past we patched the default invoke_as spec in gcc/gcc.c as follows to do it: static const char *invoke_as = -"%{!S:-o %{|!pipe:%g.s} |\n as %(asm_options) %{!pipe:%g.s} %A }"; +"%{!S:-o %{|!pipe:%g.s} |\n\ +%{!pipe:perl -e open(I,\"<%g.s\");open(X,\">%g.sa\");\ +while(){print\\ X\\ $_;\ +print\\ X\\ \"\\\\$compiler$i:\\\\n\"\\ if\\ /^.NO_APP/;\ +print\\ X\\ \"\\\\$handwritten$i:\\\\n\"\\ if\\ /^.APP/;\ +$i++;}close(I);close(X);rename(\"%g.sa\",\"%g.s\"); }\n\ +%{pipe:perl -e while(<>){print;\ +print\\ \"\\\\$compiler$i:\\\\n\"\\ if\\ /^.NO_APP/;\ +print\\ \"\\\\$handwritten$i:\\\\n\"\\ if\\ /^.APP/;\ +$i++;} } |\n\ +as %(asm_options) %{!pipe:%g.s} %A }"; This runs the compiler output through perl and inserts textual symbols in the assembly. This way the assembler later on inserts the necessary symbols in the output file. In gcc-4.0.1 this patch doesn't work anymore. In gcc/gcc.c this now looks like: static const char *invoke_as = #ifdef AS_NEEDS_DASH_FOR_PIPED_INPUT "%{!S:-o %|.s |\n\ %{!pipe:perl -e open(I,\"<%g.s\");open(X,\">%g.sa\");\ while(){print\\ X\\ $_;\ print\\ X\\ \"\\\\$compiler$i:\\\\n\"\\ if\\ /^.NO_APP/;\ print\\ X\\ \"\\\\$handwritten$i:\\\\n\"\\ if\\ /^.APP/;\ $i++;}close(I);close(X);rename(\"%g.sa\",\"%g.s\"); }\n\ %{pipe:perl -e while(<>){print;\ print\\ \"\\\\$compiler$i:\\\\n\"\\ if\\ /^.NO_APP/;\ print\\ \"\\\\$handwritten$i:\\\\n\"\\ if\\ /^.APP/;\ $i++;} } |\n\ as %(asm_options) %|.s %A }"; #else "%{!S:-o %|.s |\n as %(asm_options) %m.s %A }"; #endif After a configure: ../configure --host=i686-pc-linux-gnu --target=i686-linux --disable-threads --enable-languages=c --prefix=/export/home/lvanput/architectures/ia32/b216 _gc401_gl235/ --disable-shared and make, I get this error message: xgcc: braced spec '!pipe:perl -e open(I,"<%g.s");open(X,">%g.sa");while(){print\ X\ $_;print\ X\ "\\$compiler$i:\\n"\ if\ /^.NO_APP/;print\ X\ "\\$handwritten$i:\\n"\ if\ /^.APP/;$i++;}close(I);close(X);rename("%g.sa","%g.s"); } %{pipe:perl -e while(<>){print;print\ "\\$compiler$i:\\n"\ if\ /^.NO_APP/;print\ "\\$handwritten$i:\\n"\ if\ /^.APP/;$i++;} } | as %(asm_options) %|.s %A' is invalid at '(' This previously worked for gcc-3.3.2. From the documentation I understood that the specs substition rules have been extended and that ';' has a special meaning inside %{} Does anyone knows how to work around this problem? Or even better, does anyone knows how to patch the GNU assembler to emit symbols when it reads in #APP and #NO_APP? Thanks in advance, Ludo Van Put