arm-elf-ld and default paths for library search

OP #1174369
Rate this post
• ▲ 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?
Moderator #1174370
Rate this post
• ▲ 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.
OP #1174371
Rate this post
• ▲ 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.
#1174372
Rate this post
• ▲ 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

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

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.