EmbDev.net

Forum: ARM programming with GCC/GNU tools Linking standard libc.a and libg.a in arm-none-eabi


von venkat k. (Company: none) (venkat)


Rate this post
useful
not useful
Hi All,

My code works fine without any std lib calls. If I make any std lib 
call,
the linking fails. for e.g. undefined reference to 'malloc'.

I have used
GROUP(-lc -lg) in .ld file.

I have also added the lib file in arm-none-eabi-ld...

arm-none-eabi-ld -v 
-T../CodeSourcery/Sourcery_G++_Lite/arm-none-eabi/lib/bco_setup2.ld -L 
../CodeSourcery/Sourcery_G++_Lite/arm-none-eabi/lib -lc -lg -o image.elf 
demo.o  asm-vector.o asm-isr.o start.o

Do you see anything missing?

Regards

von ZiZi (Guest)


Rate this post
useful
not useful
Better to use the *-gcc command rather than the *-ld command for linking 
too, as it knows what std libs need to be linked to a C program without 
explicitely mentioning it on the command line.

HTH,

ZiZi.

von venkat k. (Company: none) (venkat)


Rate this post
useful
not useful
Thanks...
This solved the problem.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.