STRIP(1)STRIP(1)


NAME
     strip - Removes symbols and relocation bits

SYNOPSIS
     strip [-b] [-f] [-h] [-u] [-l] [-o outfile] [-r] [-s] [-S] [-V] [-x]
     name ...

DESCRIPTION
     The strip command removes the symbol table (the section named .symtab,
     ELF section kind SHT_SYMTAB) and relocation bits ordinarily attached
     to the output of the assembler and loader.  This is useful to save
     space after a program has been debugged.

     Unless -f option is specified, only objects marked with ELF type
     ET_EXEC (the type given to main programs) are stripped.  See
     /usr/include/elf.h for the type codes.

     The effect of the default strip is similar to the use of the -s option
     of ld.

     strip accepts the following options:

     -f   Allows stripping information from any ELF file (including
          relocatable object files and Dynamic Shared Objects) and any ELF
          file inside an archive.

     -h   Removes symbol names from SHT_DYNSYM and/or SHT_SYMTAB section
          symbol entries marked STO_HIDDEN or STO_INTERNAL.  Makes strings
          in certain string tables into all zeros.  (Symbols may be marked
          STO_HIDDEN or STO_INTERNAL by the ld(1) options -hidden_symbol or
          -hides_file.)  This option saves no space in the object, so there
          is no point to using it on most ELF files.

     -l   Strips line number information only from -n32 or -64 object
          files.  Does not strip the ELF symbol table or debugging
          information other than the line number information.  Does nothing
          on -32 object files.

     -o outfile
          Specifies a name for the output file.  Do not specify more than
          one name to strip, because only one stripped output file is
          created if -o outfile is specified.  The output file is created
          with mode 0644.

     -u   When combined with the -o option, the new output file has the
          current user ID and group ID.  By default (without -u), -o
          applies the user ID and group ID of the input file to the output
          file.  This option is ignored if -o not also specified.

     -s   Strips some sections beyond the default strippable set.  pixie,
          cord, and some other object tools cannot be used on a dso or
          a.out with these additional sections stripped.  This is intended
          for standalone programs (for which the space savings is more
          important than the ability to use object tools on the resulting
          file).

     -k   When specified with the -s option, adds the .debug_frame section
          to the list of sections stripped.  This option is not relevant
          for old 32-bit ABI objects.  When specified without -s, the -k
          option does nothing at all.  If the .debug_frame section (which
          only appears in n32 and 64 ABI objects) is stripped from an
          executable, DSO, or object, then C++ exception handling may
          silently work incorrectly.  Do not specify -k on any DSO.
          Specify -k on an executable only if space saving on disk is of
          paramount importance and you know that no C++ exceptions can
          occur in the application (and preferably none can occur in any
          DSO it calls (directly or indirectly)).

     -S   Suppress all messages (run silently).

     -V   Prints, on stderr, the version number of strip.

     -x   Turns off stripping the ELF .symtab (SHT_SYMTAB) symbol table
          section from the object.

   Diagnostics
     strip returns 0 to the environment if there are no errors.  In case of
     any error, a non-zero value is returned to the environment with
     exit(3).

NOTES
     Specifying the -b and -r options have no effect other than printing a
     warning.  These options will be removed in a future release.

     Temporary files are created during execution.  Up to three times the
     space of each original file being stripped may be needed while the
     program is in operation.  Temporary files may be created in /usr/tmp
     and in the directory given on the command line (if no directory is
     specified in the file pathname the current directory is assumed).  If
     the command is strip /a/b/c then the directory /a/b must have
     permissions to allow file creation, writing, and reading.  Whether
     /a/b/c is a file (with or without multiple links) or a symbolic link
     to a file, the directory /a/b must allow file creation, writing, and
     reading.  If /a/b/c is a symbolic link, then the true directory of the
     real file (which could be on a different machine or file system than
     /a/b) must also allow file creation, writing, and reading.

     The -s option removes the line-table section removed by the -l option,
     so using both is like specifying the -s option without the -l option.

FILES
     strp1xxxxx
     strp2xxxxx
     /usr/tmp/strp1xxxxx
     /usr/tmp/strp2xxxxx

     where xxxxx is a suffix created by tempnam(3S).

SEE ALSO
     ld(1), pixie(1), tempnam(3S), cord(1)