From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8532 invoked by alias); 16 Jun 2008 13:33:54 -0000 Received: (qmail 8523 invoked by uid 22791); 16 Jun 2008 13:33:53 -0000 X-Spam-Check-By: sourceware.org Received: from mms3.broadcom.com (HELO MMS3.broadcom.com) (216.31.210.19) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 16 Jun 2008 13:33:36 +0000 Received: from [10.11.16.99] by MMS3.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Mon, 16 Jun 2008 06:33:23 -0700 X-Server-Uuid: B55A25B1-5D7D-41F8-BC53-C57E7AD3C201 Received: by mail-irva-10.broadcom.com (Postfix, from userid 47) id 76A5F2B1; Mon, 16 Jun 2008 06:33:23 -0700 (PDT) Received: from mail-irva-8.broadcom.com (mail-irva-8 [10.11.18.52]) by mail-irva-10.broadcom.com (Postfix) with ESMTP id 636D72B0 for ; Mon, 16 Jun 2008 06:33:23 -0700 (PDT) Received: from mail-irva-13.broadcom.com (mail-irva-13.broadcom.com [10.11.16.103]) by mail-irva-8.broadcom.com (MOS 3.7.5a-GA) with ESMTP id GYF92198; Mon, 16 Jun 2008 06:33:22 -0700 (PDT) Received: from NT-IRVA-0752.brcm.ad.broadcom.com (nt-irva-0752 [10.8.194.67]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 3E49074CFF for ; Mon, 16 Jun 2008 06:33:22 -0700 (PDT) Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: RE: Is this a GCC bug? Date: Mon, 16 Jun 2008 13:33:00 -0000 Message-ID: <2E073B3ABB3F664DBA1D1C4D5FB47EF40E05CFD5@NT-IRVA-0752.brcm.ad.broadcom.com> In-Reply-To: <2E073B3ABB3F664DBA1D1C4D5FB47EF40E05CFC4@NT-IRVA-0752.brcm.ad.broadcom.com> References: <2E073B3ABB3F664DBA1D1C4D5FB47EF40E05CFC4@NT-IRVA-0752.brcm.ad.broadcom.com> From: "Bingfeng Mei" To: gcc@gcc.gnu.org X-WSS-ID: 6448B42963S67011497-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2008-06/txt/msg00353.txt.bz2 I realized I probably need to write CRT_CALL_STATIC_FUNCTION myself. That should solve the issue.=20 -----Original Message----- From: gcc-owner@gcc.gnu.org [mailto:gcc-owner@gcc.gnu.org] On Behalf Of Bingfeng Mei Sent: 16 June 2008 14:01 To: gcc@gcc.gnu.org Subject: Is this a GCC bug? Hello, I encountered a problem in porting GCC (4.3.0) when I tried to make contructor/destructor work. The following is the error message compiling crtstuff.c.=20=20 ../../src/gcc/crtstuff.c: In function 'call___do_global_ctors_aux':=20 ../../src/gcc/crtstuff.c:562: error: expected string literal before '(' token=20 Line 562 is: ... CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, __do_global_ctors_aux) ... The following is how the macro CRT_CALL_STATIC_FUNCTION is defined.=20 #ifndef CRT_CALL_STATIC_FUNCTION # define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ static void __attribute__((__used__)) \ call_ ## FUNC (void) \ { \ asm (SECTION_OP); \ FUNC (); \ FORCE_CODE_SECTION_ALIGN \ asm (TEXT_SECTION_ASM_OP); \ } #endif Here is the C code of line 562 after preprocessing in our porting: static void __attribute__((__used__)) call___do_global_ctors_aux (void) { asm ("\t.section\t.init"); __do_global_ctors_aux (); asm ((firepath_fnsc ? "\t.section .textc, \"axC\"" : "\t.section .text, \"axU\"")); } The error is because inline asm only accepts string literal, not an expression. Our definitiion of TEXT_SECTION_ASM_OP is a string depends on one of our particular targets.=20 According to GCC internal manual, it is clearly stated that TEXT_SECTION_ASM_OP can be an expression.=20 TEXT_SECTION_ASM_OP A C expression whose value is a string, including spacing, containing the assembler operation that should precede instructions and read-only data. Normally "\t.text" is right. So I guess either internal manual or crtstuff.c is wrong. Or I am making some stupid mistake here. Could someone have a look at this? Thanks in advance. Cheers, Bingfeng Mei Broadcom UK