This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Questions related to creation of libgcov.so
Hi,
On Fri, 24 Aug 2018, Martin Liška wrote:
> If I see correctly, for libgcc has following files:
>
> /home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/9.0.0/libgcc_eh.a
> /home/marxin/bin/gcc/lib64/gcc/x86_64-pc-linux-gnu/9.0.0/libgcc.a
> /home/marxin/bin/gcc/lib64/libgcc_s.so.1
> /home/marxin/bin/gcc/lib64/libgcc_s.so
And with configure option --enable-version-specific-runtime-libs ?
> where the trick is done in gcc.c in init_gcc_specs function.
> For shared version, they use -lgcc_s while for static -lgcc.
That's orthogonal. You shouldn't need that hack with libgcov (though it
might indeed be that you need to place the .so symlink and the .a file
into the same directory).
> That explains why I had issues with current layout that static
> version was preferred.
No, a shared library will always be preferred by the link editor (when not
using -static) _if_ the .so symlink (not the .so.1 files) can be found in
the search dirs (either before or in the same directory as the .a file).
In this case libgcov.so needs to be placed in some directory that's
searched by default by the link editor (when called from gcc).
Ciao,
Michael.