how to link a section in specific .o inside .a via linker script?
Mat Hostetter
mat@lcs.mit.edu
Sat Jan 13 23:02:00 GMT 2007
More information about the Binutils mailing list
Sat Jan 13 23:02:00 GMT 2007
- Previous message (by thread): how to link a section in specific .o inside .a via linker script?
- Next message (by thread): how to link a section in specific .o inside .a via linker script?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> 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?
Thanks for the suggestion. Unfortunately it doesn't work. I've been
reading through ldgram.y and ldlang.c and there just doesn't seem to
be support for this level of specificity.
I've been playing around with an experimental patch to fix this, where
there is a new (admittedly ugly) MEMBER operator in the linker script
that lets you specify a pair of a .a and .o file, that you can use in
place of any normal (possibly wildcarded) filename, e.g in my case:
/* Only get .text section from bar.o inside foo.a */
.text : { MEMBER(foo.a , bar.o)(.text) }
or even:
/* Only get .text section from either bar.o or baz.o inside foo.a */
.text : { MEMBER(foo.a , bar.o baz.o)(.text) }
The MEMBER operator produces a 'wildcard_spec' just like a normal
filename would, but it fills in a new 'struct name_list' field on the
wildcard_spec that, if non-null, restricts the linker to only
considering the specified members in the archive.
I've never looked at this part of the ld sources before, and I admit
I'm doing a lot of guesswork in the implementation, so I'd be happy to
hear any suggestions from someone familiar with the code.
-Mat
- Previous message (by thread): how to link a section in specific .o inside .a via linker script?
- Next message (by thread): how to link a section in specific .o inside .a via linker script?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list