This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
calling function in .init and .fini gives problem
- From: "mohanlal jangir" <mohanlaljangir at hotmail dot com>
- To: <gcc at gcc dot gnu dot org>
- Date: Thu, 20 May 2004 20:10:35 +0530
- Subject: calling function in .init and .fini gives problem
- Reply-to: "mohanlal jangir" <mohanlaljangir at hotmail dot com>
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?
#include <stdio.h>
int __attribute__((__section__(".init"))) premain(void) {
printf("it should appear before main!!!\n");
return 0;
}
int main(void) {
printf("******************\n");
printf("in main\n");
printf("main is returning\n");
printf("******************\n");
return 0;
}
static int __attribute__((__section__(".fini"))) postmain(void) {
printf("it should appear after main!!!\n");
return 0;
}
Regards
Mohanlal
P.S. Please cc me in reply, I am not subscribed to list.