[gccsdk] Help with gas

Ralph Corderoy ralph at inputplus.co.uk
Sun Dec 30 08:50:53 PST 2012

Hi Gavin,

> I am making a serious effort (again) to get to grips with gcc4_1_2r2.
> I am trying to assemble a short piece of ARM code with
>      gcc -o sys.o sys.s

Try one of

    gcc -c sys.s
    gcc -c -o sys.o sys.s

> I keep getting an error:
> ....: In function 'crt1_data':
> crt0.S:(.data+0x14): undefined reference to 'main'
> collect2: ld returned 1 exit status
> make: *** [sys.o] Error 1

Without -c for `compile only' the C compiler kicks off the
linker/loader, the `ld' in the output, to produce a finished executable.
ld observes the C runtime tries to call main() but no main() is defined.

Cheers, Ralph.

More information about the gcc mailing list