1
votes

I have installed two tool-chains to compile ARM/Linux in x86 host. Now, I have to compile a program for ARM/Linux (Android) with arm-eabi-gcc. This compiler doesn't have any library to use in Linux, so that I need to execute the next command to compile a C program:

arm-eabi-gcc hello.c -I/home/alejandro/android-ndk-r10c/platforms/android-21/arch-arm/usr/include -nostdlib -Wl,-rpath-link=/usr/arm-linux-gnueabi/lib -L/usr/arm-linux-gnueabi/lib -lc

But when I compile it, I get a linker warning:

ld: warning: cannot find entry symbol _start; defaulting to 000080b0

What should I do to link everything correctly?

2

2 Answers

0
votes

_start exists in the C runtime library. You will need to link this in with your binary. On Linux this is typically found in a file named crt0.a and was probably built by your compiler or LibC.

0
votes

Just try by taking out the option -nostdlib because the compiler thinks it is not allowed to use the start up files in which the _start function is present.

but there is a other way around

. implement your own crt0.o which should basically contain _start function

 void _start()

{


ctor_dtor_hook *hook;



__syslib_init();

for (hook = __CTORS__; *hook; hook++)
     (*hook)();

main();

for (hook = __DTORS__; *hook; hook++)
     (*hook)();
}

use int main() if you tried to implement c++

and link the crt0.o object to the program you are running and put -nostdlib