如何改变用gcc编译的C程序的入口点?
#include<stdio.h>
int entry() //entry is the entry point instead of main
{
return 0;
}
发布于 2018-05-09 16:48:20
这是一个链接器设置:
-Wl,-eentry
发布于 2018-05-09 17:56:56
你可以将你的源代码修改为:
#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);
}
然后将该程序构建为可执行的共享库:
$ gcc -shared -fPIC -e entry test_main.c -o test_main.so
$ ./test_main
https://stackoverflow.com/questions/-100004053
复制相似问题