Re: usage of --start-group and --end-group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2018-05-17 16:34 +0800,tong chen wrote:
> 2018-05-17 16:09 GMT+08:00 Jonathan Wakely <jwakely.gcc@xxxxxxxxx>:
> > On 17 May 2018 at 08:48, tong chen wrote:
> > > yeah, It works if places -lintl -lz to the end of the cmd.
> > > I think It will work with --start-group/--end-group, but It doesn't  .
> > 
> > I think the group will cause the linker to loop over those libraries
> > in the group, but only at the specified position in the argument list.
> > 
> > If there are no unresolved references at that point, the linker will
> > stop looping over the group and continue to other arguments. After
> > processing the other arguments there are more unresolved references,
> > but it's too late for libint and libz to help, because they've already
> > been processed.
> 
> Thanks for your reply, but is this true?
> There is some text from <Using ld, the GNU Linker> book:
> 
> The specified archives are searched repeatedly until no new undefined references
> are created. Normally, an archive is searched only once in the order that it is
> specified on the command line. If a symbol in that archive is needed to resolve
> an undefined symbol referred to by an object in an archive that appears later
> on the command line, the linker would not be able to resolve that reference.
> By grouping the archives, they all be searched repeatedly until all possible
> references are resolved.
> 
> According to this, is the grouped archives will be searched repeatedly while
> processing every archives on the command line, even they appears later??

But libelf_pic.a is NOT in the group.

It should be

-Wl,--start-group -lintl -lz -Wl,--whole-archive libelf_pic.a \
-Wl,--no-whole-archive,--no-undefined,--end-group

And note that this is off topic. This is gcc-help, not binutils-help.  After
all, the value of -Wl is directly passed to the linker.
-- 
Xi Ruoyao <ryxi@xxxxxxxxxxxxxxxxx>
School of Aerospace Science and Technology, Xidian University



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux