How to change entry point of C program with gcc?

asitm9 picture asitm9 · Sep 21, 2011 · Viewed 31.8k times · Source

How to change the entry point of a C program compiled with gcc ?
Just like in the following code

#include<stdio.h>
int entry()  //entry is the entry point instead of main
 {
   return 0;
 }

Answer

Foo Bah picture Foo Bah · Sep 21, 2011

It's a linker setting:

-Wl,-eentry

the -Wl,... thing passes arguments to the linker, and the linker takes a -e argument to set the entry function