Re: [arm-gnu] linking with -lm to use math library functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] linking with -lm to use math library functions



Adam Muff wrote:

arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -O2 -MD -std=c99 -Wall -pedantic -DPART_LM3S6965 -c -Dgcc -o gcc/test.o test.c
arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -O2 -MD -std=c99 -Wall -pedantic -DPART_LM3S6965 -c -Dgcc -o gcc/startup_gcc.o startup_gcc.c
arm-none-eabi-ld -T ../../DriverLib/gcc/standalone.ld --entry ResetISR --gc-sections -o gcc/test.axf gcc/test.o gcc/startup_gcc.o c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.2.1/../../../../arm-none-eabi/lib/thumb2/libc.a c:/program files/codesourcery/sourcery g++ lite/bin/../lib/gcc/arm-none-eabi/4.2.1/thumb2/libgcc.a -lm

We advise customers to link with "arm-none-eabi-gcc", not "arm-none-eabi-ld". If you use "ld", you have to manually pull in all the libraries that "gcc" will automatically include.

However, in your case, you probably just need to put libm before libgcc. The linker only pulls code out of a library if it knows it's needed at that point in processing the command line.

--
Mark Mitchell
CodeSourcery
mark@xxxxxxxxxxxxxxxx
(650) 331-3385 x713