This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
what's the right way to use custom entry point
- From: Cong Monkey <congzhangzh at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sat, 22 Oct 2016 15:42:34 +0800
- Subject: what's the right way to use custom entry point
- Authentication-results: sourceware.org; auth=none
Hi,
I want use custom entry point, but it's very strange!
entry_point_test.c file:
int sayhello(int argc, char** argv)
{
return 0;
}
if I do:
cc ../entry_point_test.c -o entry_point_test -Wl,-esayhello
then I get:
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/crt1.o:
In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
if I do:
cc ../entry_point_test.c -o entry_point_test -Wl,-esayhello
-nostartfiles #cc works
./a.out
then I get:
# Segmentation fault
anyone can help what should I do?
Tks