Re: c++ static object not created

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

 



Kövesdi György wrote:
>> It's doing what it's supposed to do.  When you link against a static
>> library, an objects is only pulled into the executable if there's a
>> reference to it.
> 
> Is there a possibility to force linking the unreferenced objects too? I didn't 
> find such option for the linker.

Did you really look?

       --whole-archive
           For  each  archive  mentioned  on  the  command  line   after   the
           --whole-archive option, include every object file in the archive in
           the link, rather than searching the archive for the required object
           files.  This is normally used to turn an archive file into a shared
           library, forcing every object  to  be  included  in  the  resulting
           shared library.  This option may be used more than once.

           Two  notes when using this option from gcc: First, gcc doesn't know
           about this option, so you have to use -Wl,-whole-archive.   Second,
           don't  forget  to  use  -Wl,-no-whole-archive  after  your  list of
           archives, because gcc will add its own list  of  archives  to  your
           link and you may not want this flag to affect those as well.

[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