Re: .a file not linking correctly

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

 



Thanks for your fast reply, Jonathan!

poptools.c is generated by software. On this case, it has some calls
to functions defined on .o files inside the libpop.a .
The strange part is that if I do not include libpop.a in command line,
there is no error but the empty elf. If i remove --gc-sections (or
change it to --no-gc-sections) then I get some undefined references
error. If I include libpop.a, there is no error, I have a big elf and
it doesn't work in my board. It seems to be a link error but I am not
able to figure out what is going on...

Thanks again!

Marcelo Utikawa da Fonseca

2015-04-01 10:20 GMT-03:00 Jonathan Wakely <jwakely.gcc@xxxxxxxxx>:
> 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 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