how to link a section in specific .o inside .a via linker script?

Dave Korn dave.korn@artimi.com
Sat Jan 13 14:27:00 GMT 2007


On 12 January 2007 19:06, mat@lcs.mit.edu wrote:

> I am creating a linker script to place sections at exactly the
> addresses I want them.
> 
> In a linker script it is easy to link in just a section from
> a specific .o file, like this:
> 
>     .text : { bar.o(.text) }
> 
> However, I want a specific section from a specific .o file that is
> inside a specific .a file. Naively, given the textual format used to
> describe archive members in -Map files, I hoped this would work:
> 
>     .text : { /lib/libc.a(bar.o)(.text) }
> 
> But it doesn't parse. I can't seem to figure out a way to name just
> this one section in that .o file in the archive.
> 
> Is this possible? Thanks!

 I don't know and I haven't tried it, but did you try it like:

     .text : { /lib/libc.a(bar.o(.text)) }

...since the .text is a section of bar.o, not of libc.a?

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....



More information about the Binutils mailing list