Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Is there a way to tell if a binary is linked statically or to a shared library ?

0
Posted

Is there a way to tell if a binary is linked statically or to a shared library ?

0

Ans: Yes. Use the utility `ldd’. This gives you information on what libraries are required. If no output is generated when you run `ldd’ on a program then it indicates the program was linked statically. Eg (1): the command (on my linux system) % ldd /bin/init gives no output meaning init was linked statically. And a good thing too it was linked statically 🙂 (NOTE: For programs linked with libc.so.4.5.19 and above, the message “statically linked” will be output in this case). For statically linked ELF executables you will get the message “statically linked (ELF)”. Eg (2): the command (on my linux system) % ldd /usr/bin/gs i.e. the ghostscript interpreter gives the following output. libm.so.4 => /lib/libm.so.4.4 (4.0) libX11.so.3 => /lib/libX11.so.3.0 (DLL Jump 3.0pl0) libc.so.4 => /lib/libc.so.4.4 (DLL Jump 4.3) This tells me that the program `gs’ was dynamically linked and requires three shared libraries. The numbers in brackets tell me that only one library, (libX11), matches the cu

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123