Re: How to create a ROM library using GNU gcc and ld?
- From: Arlet Ottens <usenet+5@xxxxxxxxxx>
- Date: Mon, 31 Mar 2008 20:35:40 +0200
wyse03br@xxxxxxxxxxxx wrote:
Hi,
On Mar 31, 2:59 am, Arlet <usene...@xxxxxxxxxx> wrote:You could use partial linking.
Use: ld -r with your object files and libraries to generate another .o
file.
Name this .o file explicitly in your linker script to put it in the
ROM area.
If I understood correctly, compilation and linking will be done in
2 steps - first compile the ROM library functions generating an a.aux
intermediary file and second link it when compilling the non ROM
library functions (main(), for instance):
% ppc-elf-gcc -g lib.c -lm -Wl,-T lib.lnk -Wl,-r -o a.aux -DROM #-
DROM selects the ROM-based routines
% ppc-elf-gcc lib.c -Wl,-T lib_aux.lnk a.aux -o a.out
This strategy doesn't work so well, because some symbols are
introduced twice (apparently by CRT0):
/lib/gcc-lib/ppc-elf/3.3.2/crtsavres.o(.text+0x1cc): In function
`_restgpr_31_x':
: multiple definition of `_restgpr_31_x'
a.aux(.text+0x1578): first defined here
collect2: ld returned 1 exit status
Have I misundestood something? Any workaround?
Don't use gcc for the partial link.
First use gcc to convert .c file into .o file, then call ld manually to do partial link (without linker script). Something like this:
% ppc-elf-gcc -g -c lib.c -DROM # creates lib.o file
% ppc-elf-ld -g -r -o a.aux lib.o -lm # add library code
Then build the rest of your project, adding a.aux file to final link stage.
I would call it rom.o instead of a.aux, but that's a personal preference.
.
- Follow-Ups:
- Re: How to create a ROM library using GNU gcc and ld?
- From: wyse03br
- Re: How to create a ROM library using GNU gcc and ld?
- From: Tauno Voipio
- Re: How to create a ROM library using GNU gcc and ld?
- References:
- How to create a ROM library using GNU gcc and ld?
- From: wyse03br
- Re: How to create a ROM library using GNU gcc and ld?
- From: Arlet
- Re: How to create a ROM library using GNU gcc and ld?
- From: wyse03br
- How to create a ROM library using GNU gcc and ld?
- Prev by Date: Re: How to create a ROM library using GNU gcc and ld?
- Next by Date: Re: How to create a ROM library using GNU gcc and ld?
- Previous by thread: Re: How to create a ROM library using GNU gcc and ld?
- Next by thread: Re: How to create a ROM library using GNU gcc and ld?
- Index(es):
Relevant Pages
|