This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: .a file not linking correctly


On 1 April 2015 at 14:15, Marcelo Utikawa da Fonseca wrote:
> Hi!
>
> I am new to the list but I work with gcc and cross-compiling for
> several years. Now I am facing something new: I can generate a .elf
> file from *.o files. If I join the same files in a .a file and try to
> use it instead of *.o files, I always get an empty file. Please note:
> it is not an zero size file, just empty elf... It is a valid .elf file
> but without any sections.

Does anything in your poptools.c file actually refer to any symbols
defined in the .a archive?

If not, the linker will not need to search the archive and so will not
include any of the archive contents in the output.

You can use -Wl,--whole-archive libpop.a -Wl,--no-whole-archive to
force the linker to include everything in the archive even if it isn't
needed.


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