On 08/24/2018 04:37 PM, Michael Matz wrote: > 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
Hello. > > And with configure option --enable-version-specific-runtime-libs ? Then it will install following files: /home/marxin/bin/gcc2/lib64/gcc/x86_64-pc-linux-gnu/lib64/libgcc_s.so.1 /home/marxin/bin/gcc2/lib64/gcc/x86_64-pc-linux-gnu/lib64/libgcc_s.so /home/marxin/bin/gcc2/lib64/gcc/x86_64-pc-linux-gnu/9.0.0/libgcc_eh.a /home/marxin/bin/gcc2/lib64/gcc/x86_64-pc-linux-gnu/9.0.0/libgcc.a > >> 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). Ok, let me send final version of the patch. I'll move that into gcc-patches ML. Martin > > > Ciao, > Michael. >