This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: calling function in .init and .fini gives problem
- From: "mohanlal jangir" <mohanlaljangir at hotmail dot com>
- To: "Janis Johnson" <janis187 at us dot ibm dot com>
- Cc: <gcc at gcc dot gnu dot org>,"Diego Novillo" <dnovillo at redhat dot com>
- Date: Fri, 21 May 2004 09:45:20 +0530
- Subject: Re: calling function in .init and .fini gives problem
- References: <BAY16-DAV11QgHESeQB00011312@hotmail.com> <20040520164051.GA4357@us.ibm.com>
- Reply-to: "mohanlal jangir" <mohanlaljangir at hotmail dot com>
Thanks for your replies. Attributes "constructor" and "destructor" works
very well. Does it mean attribute "constructor" puts the given data in .init
section (similarly for destructor and .fini)? And why it does not work when
I try to put the data by specifying __section__(".init")?
Regards
Mohanlal
----- Original Message -----
From: "Janis Johnson" <janis187@us.ibm.com>
To: "mohanlal jangir" <mohanlaljangir@hotmail.com>
Cc: <gcc@gcc.gnu.org>
Sent: Thursday, May 20, 2004 10:10 PM
Subject: Re: calling function in .init and .fini gives problem
> On Thu, May 20, 2004 at 08:10:35PM +0530, mohanlal jangir wrote:
> > I tried to run following program, but is giving "Illegal instruction"
error
> > after function premain is called. Can somebody correct me, what I am
doing
> > wrong?
> >
> > int __attribute__((__section__(".init"))) premain(void) {
> >
> > static int __attribute__((__section__(".fini"))) postmain(void) {
>
> See function attributes "constructor" and "destructor" in the GCC Manual.
>
> Janis
>