How to change entry point of C program with gcc?
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; } 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 You can modify your source code as: #include<stdio.h> const char my_interp[] __attribute__((section(".interp"))) = "/lib/ld-linux.so.2"; int entry() //entry is the entry point instead of main { exit(0); } The ".interp" section will let your program able to call external