# Forum: ARM programming with GCC/GNU tools arm-elf-ld and default paths for library search

Rate this post
 0 ▲ useful ▼ not useful
1) Do i need to provide the arm-elf-ld with default paths for finding
libraries libc.a, libma.a and libgcc.a ?
2) If yes, which option should be used to make the arm-elf-ld search the
path to find these libraries?

Rate this post
 0 ▲ useful ▼ not useful
Vinit Bidkar wrote:
> 1) Do i need to provide the arm-elf-ld with default paths for finding
> libraries libc.a, libma.a and libgcc.a ?
> 2) If yes, which option should be used to make the arm-elf-ld search the
> path to find these libraries?

Environment details (Yagarto):

make:                3.18
binutils:            2.18
arm-elf-gcc:         4.2.2
newlib:              1.16.0
gdb:                 6.8.50-20080308-cvs

Is there any way by which i can include the libc.a, libm.a and libgcc.a
from the default (Yagarto) locations?

Rate this post
 0 ▲ useful ▼ not useful
Vinit Bidkar wrote:
> Vinit Bidkar wrote:
>> 1) Do i need to provide the arm-elf-ld with default paths for finding
>> libraries libc.a, libma.a and libgcc.a ?
>> 2) If yes, which option should be used to make the arm-elf-ld search the
>> path to find these libraries?
>
> Environment details (Yagarto):
>
> make:                3.18
> binutils:            2.18
> arm-elf-gcc:         4.2.2
> newlib:              1.16.0
> gdb:                 6.8.50-20080308-cvs
>
> Is there any way by which i can include the libc.a, libm.a and libgcc.a
> from the default (Yagarto) locations?

Yes, don't use arm-elf-ld directly but link with the compiler-frontend
(arm-elf-gcc). You may look into a makefile from one of my examples on
www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects to see how this can
be done.

Rate this post
 0 ▲ useful ▼ not useful
Martin Thomas wrote:
> Vinit Bidkar wrote:
>> Vinit Bidkar wrote:
>>> 1) Do i need to provide the arm-elf-ld with default paths for finding
>>> libraries libc.a, libma.a and libgcc.a ?
>>> 2) If yes, which option should be used to make the arm-elf-ld search the
>>> path to find these libraries?
>>
>> Environment details (Yagarto):
>>
>> make:                3.18
>> binutils:            2.18
>> arm-elf-gcc:         4.2.2
>> newlib:              1.16.0
>> gdb:                 6.8.50-20080308-cvs
>>
>> Is there any way by which i can include the libc.a, libm.a and libgcc.a
>> from the default (Yagarto) locations?
>
> Yes, don't use arm-elf-ld directly but link with the compiler-frontend

Thnak you Martin Thomas.
It helped, but i had to use -Xlinker option as -Wl giving errors.

Rate this post
 0 ▲ useful ▼ not useful
Martin Thomas wrote:
> Yes, don't use arm-elf-ld directly but link with the compiler-frontend

Personally I prefer to use the linker directly, but the advantage of
using the compiler to drive the linker is that it sets the default
library paths according to the architecture options, whereas when you
invoke the linker you have to select the appropriate libraries yourself.

Whether you choose to invoke the linker directly or not explicit paths
may be set with -L<path> options. Moreover you can specify -nostlibs and
be responsible for specifying your own libraries with -l<libname>
options. This is useful perhaps if you need a custom library build - as
I did to support the VFP math co-processor not yet in the standard
build.

Mostly however, do what Martin suggested, since it is harder to get it
wrong. :-)

Clifford

• $formula (LaTeX syntax)$