[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: What is "stripping" in binary compilations ?



Maxim Vexler <hq4ever@gmail.com> writes:

> I'm reading the "New maintainer's guide".

> On page 28 (version 1.2.3,18 January2005) the author speaks about
> `stripping' executable and the dh_strip(1) script. Surprisingly, no
> where was the reader informed about the purpose of `striping'. Am I
> supposed to know this as part of "basic knowledge" ? If so where can I
> learn more about stripping I've tried to search the Debian developers
> reference guide and the gcc online documentations, as well as google but
> no useful information has turned up.

It is somewhat basic knowledge when it comes to packaging or manipulating
compiled executables.  The basic idea is very simple:  When a binary is
built, a lot of information is retained in the binary, such as the names
of all of its functions and (if the binary was built with -g) debugging
information used by a debugger stepping through the binary.  The strip
command removes this information, which is only useful for debugging,
thereby saving often a great deal of disk space.

Certain types of binaries need to retain some of that information.  For
example, shared libraries must retain their symbol tables so that other
binaries can link against them properly.

dh_strip handles calling strip with the appropriate options and in the
appropriate ways to remove all information that's unlikely to be useful
while retaining the information still required for binaries to work
properly.  So in general, if you're using debhelper to package binaries,
the answer is "run dh_strip and it takes care of this for you."  However,
it's good to understand the basics and the reasons for what's going on
behind the scenes.

There's some additional information in section 10.1 of Policy.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>



Reply to: