[Gllug] ELF, LSB [...] , stripped

James Durie james.durie at dsl.pipex.com
Sun Oct 20 09:19:18 UTC 2002


On Sat, 2002-10-19 at 21:09, Pavel Bradut Boghita wrote: 
> I've been playing with some commands on my system and wondered about the 
> output to the file command bellow.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> user at machine:/bin$ file /bin/ls
> /bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),dynamically 
> linked (uses shared libs), stripped
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> I was wondering if someone could give me a short explanation of what this 
> means, just enough to have an idea. I searched google for ELF and LSB but I 
> only found stuff which goes on about converting from SVR4 to ELF... anyway I 
> understood that ELF is some way to package (compile) binaries... !?
> - LSB I don't know what it means, a type of executable perhaps ?
> - Intel 80386 - the minimum type of processor which can run it ?
> - version 1 (SYSV) - no idea
> - dynamically linked - there are links somewhere pointing to /bin/ls ?
> - stripped - no idea
> 
> I would really appreciate some clarification of these perhaps trivial terms 
> for some but a bit blurred for me.
> 
> Thanks a lot, 
> 
> Bradut

ELF - Executable and Linkable Format
32-bit - Its a 32 bit binary, 64-bit binaries are also possible
LSB - Least Signifcant Bit first - also known as little-endian (from
Gullivers Travels)
Executable - This ELF file describes an executable rather than a
linkable, try file /lib/libc-2.2.4.so (or similar) and you will get
/lib/libc-2.2.4.so: ELF 32-bit LSB shared object, Intel 80386, version
1, not stripped

Intel 80386 - The processor family this executable was built for,
alternatives might be Sparc or PA-Risc, etc.
Version 1 (SYSV) - It's a version 1 ELF file for a System V based box,
SYSV was the commercial offshoot of Unix originally from AT&T.

dynamically linked - This executable is linked against shared libraries
and has dependencies on those shared libraries. I.E. some of the code it
needs to run lives in another file. Executables can also be statically
linked, where the all code is copied into the one file and linked
together at that point.

Stripped - All debugging symbols have been removed to make the file
smaller. Debugging symbols can take up a very large amount of space and
areonly useful of you intend on debugging a program. Your system may
have versions of some shared libraries which still have debugging
symbols in for help in debugging your own programs but you would hav to
link against these explicitly.
The program will however still contain dynamic symbols as these are
required to match up with symbols in the shared libraries.
To see the symvols in a file use nm.

To see the shared lib dependencies of an ELF file use ldd.
ldd /bin/ls:
        libtermcap.so.2 => /lib/libtermcap.so.2 (0x40030000)
        libc.so.6 => /lib/libc.so.6 (0x40034000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

ldd /lib/libtermcap.so.2
        libc.so.6 => /lib/libc.so.6 (0x4001e000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000)


So ls is dependant of the termcap library, the standard C library and
the dynamic linker.

The termcap library is dependant on the standard C library and the
dynamic linker.

The dynamic linker is responsible for making sure the required libs are
in memory and that the symbols are matched up.

James



-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list