This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: same routines in multiple overlays
- From: Oliver Wohlmuth <oliver dot wohlmuth at freescale dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sourceware dot org
- Date: Tue, 07 Feb 2006 11:37:48 +0100
- Subject: Re: same routines in multiple overlays
- References: <43E06BE3.4030709@freescale.com> <43E354BE.3040908@redhat.com>
Hi Nick,
thank you, thats exactly what I was looking for !
I only had to make all global symbols in each codec local (beside the
main entry point), in order to make ld happy. I hoped ld will first
look for a global symbol within in the same overlay and not complain
about duplicate symbols.
To complete your example (in case someone else is interested):
ld -r -o first_codec.o foo.o bar.o
objcopy -G first_codec_main first_codec.o first_codec.o
ld -r -o second_codec.o foo.o fred.o
objcopy -G second_codec_main second_codec.o second_codec.o
ld -T codecs.t -o my_app first_codec.o second_codec.o common_code.o
Again, thank you very much for your help.
Regards,
Oliver
Nick Clifton wrote:
Hi Oliver,
Here comes my question:
Is there a way in the linker script to tell ld (version 2.16.1) to
move a static library into multiple overlays ?
Sorry no. The linker does not (currently) support this feature. You
would have to code it into the linker sources yourself.
If not, does anybody know of other way to achieve this ?
If you know all of the codecs that might be used by your users then you
can can the following approach:
* Link together the time critical parts of each codec separately using
the -r linker switch to create a relocatible object file as the output.
* Create a linker script with overlays and in each overlay load one of
your relocatable codec objects.
Eg:
ld -r -o first_codec.o foo.o bar.o
ld -r -o second_codec.o foo.o fred.o
ld -T codecs.t -o my_app first_codec.o second_codec.o common_code.o
Where codecs.t looks something like:
SECTIONS
{
OVERLAY
{
first_codec
{
.text : { first_codec.o(.text) }
}
second_codec
{
.text : { second_codec.o(.text) }
}
}
/* Everything not in an overlay goes here. */
.text : { *(.text) }
.data : { *(.data) }
}
I have not actually tested the above idea you understand, but in theory
it ought to work.
Cheers
Nick