public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Bingfeng Mei" <bmei@broadcom.com>
To: gcc@gcc.gnu.org
Subject: RE: Is this a GCC bug?
Date: Mon, 16 Jun 2008 13:33:00 -0000	[thread overview]
Message-ID: <2E073B3ABB3F664DBA1D1C4D5FB47EF40E05CFD5@NT-IRVA-0752.brcm.ad.broadcom.com> (raw)
In-Reply-To: <2E073B3ABB3F664DBA1D1C4D5FB47EF40E05CFC4@NT-IRVA-0752.brcm.ad.broadcom.com>

I realized I probably need to write CRT_CALL_STATIC_FUNCTION myself.
That should solve the issue. 

-----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.  

../../src/gcc/crtstuff.c: In function 'call___do_global_ctors_aux': 
../../src/gcc/crtstuff.c:562: error: expected string literal before '('
token 

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. 

#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. 

According to GCC internal manual, it is clearly stated that
TEXT_SECTION_ASM_OP can be an expression. 

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



  reply	other threads:[~2008-06-16 13:33 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-16 13:01 Bingfeng Mei
2008-06-16 13:33 ` Bingfeng Mei [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-01-17 23:30 Is this a gcc bug? Axel Kittenberger
2001-01-16 17:06 dewar
2001-01-14 16:14 dewar
2001-01-14 16:53 ` Dave Korn
2001-01-14  5:31 dewar
2001-01-14 15:51 ` Geoff Keating
2001-01-12 19:15 dewar
2001-01-12 19:29 ` Fergus Henderson
2001-01-12 19:14 dewar
2001-01-12 19:36 ` Alexandre Oliva
2001-01-12 18:21 dewar
2001-01-12 18:29 ` Joseph S. Myers
2001-01-12 18:49 ` Alexandre Oliva
2001-01-12 18:58 ` Fergus Henderson
2001-01-13 10:34 ` James Dennett
2001-01-16 17:01 ` Michael Eager
2001-01-17  3:21   ` Falk Hueffner
2001-01-17 14:57     ` Michael Eager
2001-01-12  1:18 Axel Kittenberger
2001-01-12 18:14 ` Alexandre Oliva
2001-01-12 19:11   ` Fergus Henderson
2001-01-13  3:21   ` Richard Earnshaw
2001-01-11 10:38 dewar
2001-01-11 10:30 dewar
2001-01-11 10:05 dewar
2001-01-11 10:00 David Korn
2001-01-11 21:36 ` Andy Walker
2001-01-13 18:45   ` Joern Rennecke
2001-01-14  2:21     ` Geoff Keating
2001-01-11  7:07 dewar
2001-01-11  5:53 dewar
2001-01-11  6:06 ` Bernd Schmidt
2001-01-11  8:40   ` Per Bothner
2001-01-11  9:03     ` Richard Earnshaw
2001-01-11  9:27       ` Alexandre Oliva
2001-01-11  9:33       ` Joe Buck
2001-01-11  9:38         ` Bernd Schmidt
2001-01-11  9:44           ` Richard Earnshaw
2001-01-11 10:57     ` Neil Booth
2001-01-11  5:49 dewar
2001-01-11  3:04 David Korn
2001-01-11  2:11 Uros Bizjak
2001-01-11  3:04 ` Alexandre Oliva

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=2E073B3ABB3F664DBA1D1C4D5FB47EF40E05CFD5@NT-IRVA-0752.brcm.ad.broadcom.com \
    --to=bmei@broadcom.com \
    --cc=gcc@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).