Matching object files in an archieve in linker script?

Nick Clifton nickc@redhat.com
Thu Jul 29 13:44:00 GMT 2004


Hi Tao,

> I know I can match an archieve in a linker script like:
> 		.ovly1 { /home/zhangta/tests/cgpart/libfoo1.a(.text) }
> 
> But is it possible to match the object files in an archieve?

No sorry - this is not possible with the current linker script syntax.

 > What if I want to give bar1.o and bar2.o in foo1.a different virtual 
addresses?
> Could it be done?

If the sections within bar1.o and bar2.o have unique names, then yes 
this can be done.  For example if bar1.o contains sections called 
.text.bar1 and .data.bar1 and bar2.o contains sections called .text.bar2 
and .data.bar2 then you could use a linker script fragment like this:

.text.bar1 : 0x1000 { /home/zhangta/tests/cgpart/libfoo1.a(.text.bar1) }
.text.bar2 : 0x2000 { /home/zhangta/tests/cgpart/libfoo1.a(.text.bar2) }
.data.bar1 : 0x4000 { /home/zhangta/tests/cgpart/libfoo1.a(.data.bar1) }
.data.bar2 : 0x5000 { /home/zhangta/tests/cgpart/libfoo1.a(.data.bar1) }

Cheers
   Nick



More information about the Binutils mailing list