This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Specify section for whole .a static library


On Thu, Apr 07, 2011 at 09:29:10AM +0200, Jan Pohanka wrote:
> Ok. Next information.
> 
> SECTIONS {
>  .foo { slibrary.a(.text) }
> }
> 
> works when -Tskript.ld option is specified AFTER the input files eg.
> gcc -o prog.exe a.o b.o -Tlinker.ld
> 
> when it is before (gcc -Tlinker.ld -o prog.exe a.o b.o), symbols from
> slibrary.a won't be found.
> 
> If I specify the object files in linker scripts, e.g.
> 
> SECTIONS {
>  .foo { s*.o(.text) }
> }
> 
> linking works without regard to -T position on command line.
> 
> The same situation occurs for INPUT, GROUP, ... commands.
> 
> Is this expected behaviour?

Yes, that't the way unix linkers work with static archives.  Files are
extracted only when they satisfy some strong undefined symbol at the
point where the linker searches the archive.

-- 
Alan Modra
Australia Development Lab, IBM


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]