bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/17196] .rsrc section from archive members are ignored (all Windo


From: nickc at redhat dot com
Subject: [Bug ld/17196] .rsrc section from archive members are ignored (all Windows targets)
Date: Tue, 26 Aug 2014 10:30:32 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=17196

Nick Clifton <nickc at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |nickc at redhat dot com

--- Comment #1 from Nick Clifton <nickc at redhat dot com> ---
Hi Benjamin,

  This is not a bug.  It is a feature, or mis-feature if you prefer.  The
problem is that the resource.o file in the resource.a archive only contains a
.rsrc section.  It does not contain any symbols.  The linker only pulls object
files out of an archive if they contain symbols that are needed by other
objects in the link.  So when you link rsrcbug.o with resource.a there are no
unresolved symbols in rsrcbug.o and so nothing is pulled out of the archive.

  There are a couple of possible workarounds for this problem:

  * You could like with --whole-archive added before resource.a.
    This will force the linker to include the resource.o file even 
    though nothing references it.  Ie:

      i686-pc-mingw32-gcc -m32 -mwin32 -mwindows -o rsrcbug-failed.exe \
       -Wl,--whole-archive rsrcbug.o resource.a -Wl,--no-whole-archive

    Of course this does negate one of the benefits of using archives - 
    namely that normally only the files that your program needs are 
    extracted from the library.

  * You could add a symbol to resource.o and then reference this symbol 
    from rsrcbug.o.  See the uploaded variation on your test archive 
    for an example of how this can be done.

Cheers
  Nick

-- 
You are receiving this mail because:
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]