Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Feb 1997 18:20:21 -0800 (PST)
From:      "Jonathan M. Bresler" <jmb>
To:        allenh@wtrt.net (Allen Hyer)
Cc:        freebsd-questions@freebsd.org
Subject:   Re: static vs. dynamically linked binaries
Message-ID:  <199702090220.SAA16607@freefall.freebsd.org>
In-Reply-To: <3.0.1.32.19970208194031.0075a288@wtrt.net> from "Allen Hyer" at Feb 8, 97 07:40:31 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Allen Hyer wrote:
> 
> 
> Is there any way to figure out if a binary was linked statically or
> dynamically?  I have some binaries around that I don't have the sources
> installed for.  Can I tell with just the binary, or do I need to go back to
> the sources?  

	yes, you can tell using the command "/usr/bin/file".

freefall jmb[140] file /kernel
/kernel: demand paged executable
freefall jmb[141] file /usr/bin/vi
/usr/bin/vi: FreeBSD/i386 demand paged dynamically linked executable

	"/usr/bin/ldd" will tell you which dynamic libs an executable
	uses.  or complain if run against a static binary

freefall jmb[145] ldd /kernel
ldd: /kernel: not a dynamic executable
/usr/bin/vi:
        -ltermcap.2 => /usr/lib/libtermcap.so.2.1 (0x805c000)
        -lcurses.2 => /usr/lib/libcurses.so.2.0 (0x8050000)
        -lutil.2 => /usr/lib/libutil.so.2.1 (0x804b000)
        -lc.2 => /usr/lib/libc.so.2.2 (0x806d000)

jmb



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702090220.SAA16607>