Hi,

I am buidling and running the following program 
#cat init.c
void my_func(void) __attribute__((section(".init")));
void
my_func(void)
{
        printf("inside my_func\n");
}

int
main()
{
        printf("inside main()\n");
        return 0;
}

When I build using gcc and run this program gives segmentation fault after 
printing "inside my_func" string.
$gcc -o init init.c
$ ./init
inside my_func
Segmentation Fault (core dumped)

When I used #pragma init(my_func) in place of 
void my_func(void) __attribute__((section(".init"))); this works fine

Could any one help me how is this happening.

regards
Bhushan
 
 
This message posted from opensolaris.org

Reply via email to