arm-elf-ld and default paths for library search

OP
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?
Moderator
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.
OP
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.
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

Reply

A question of your own? This thread is over 18 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.