shared libraries linked into executable when they are not neccessary

H.J. Lu hjl.tools@gmail.com
Thu Oct 23 20:44:00 GMT 2025


On Fri, Oct 24, 2025 at 4:15 AM Tom Kacvinsky <tkacvins@gmail.com> wrote:
>
> Hi Jose,
>
> On Thu, Oct 23, 2025 at 10:56 AM Jose E. Marchesi <jose.marchesi@oracle.com> wrote:
>>
>>
>> What DSO is being linked that you don't expect?
>>
>> There are some DSOs that are linked in every non-static executable, such
>> as ld-linux-x86-64.so, linux-vdso.so, and likely libc.so.6, libm etc.
>
>
> These are not the usual glibc shared libraries.  These are boost libraries that resolve
> symbols from some of our static libraries.  But the thing is, I cannot determine why
> all of the boost libraries we specify on the link line are used, when we really need
> only two.
>
> I'd attach my map file, but it's 15 MB.  That would be a no-no.

Please try -fuse-ld=bfd

> Tom
>
>>
>> > Hi,
>> >
>> > Not sure if this is the right list for asking this question.  If it's not,
>> > please point me to the right list.
>> >
>> > I am confused as to why a shared library - which isn't needed by
>> > an executable - is linked in.
>> >
>> > I am using binutils 2.39
>> >
>> > The link line contains
>> >
>> > -fuse-ld=gold -Wl,--as-needed -Wl,-Map,map.txt -Wl,--cref
>> >
>> > When I look at map.txt, I cannot find why the shared library is
>> > necessary.  What should I look for?
>> >
>> > This is happening with binutils 2.45 as well.
>> >
>> > Thanks,
>> >
>> > Tom



-- 
H.J.


More information about the Binutils mailing list