How does linker find shared library without SONAME
Asked Answered
S

1

4

if I create a shared library without a SONAME like this

gcc -shared libfoo.o -o libfoo.so

and link against it, how does the linker find my shared library?

Is the filename libfoo.so considered as default SONAME by the linker?

Sharpwitted answered 1/11, 2010 at 18:40 Comment(0)
O
9

I think you're right. Here what ld man pages say:

-soname=name

When creating an ELF shared object, set the internal DT_SONAME field to the specified name. When an executable is linked with a shared object which has a DT_SONAME field, then when the executable is run the dynamic linker will attempt to load the shared object specified by the DT_SONAME field rather than the using the file name given to the linker.

Omland answered 1/11, 2010 at 19:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.