Blob Blame History Raw
From 8987da9a2cac6c5bd39ba100ffd1aaede94dc6a0 Mon Sep 17 00:00:00 2001
From: Michael Pozulp <pozulp.llvm@gmail.com>
Date: Fri, 9 Aug 2019 19:10:55 +0000
Subject: [PATCH] [Docs][llvm-strip] Add help text to llvm-strip rst doc

Summary: Addresses https://bugs.llvm.org/show_bug.cgi?id=42383

Reviewers: jhenderson, alexshap, rupprecht

Reviewed By: jhenderson

Subscribers: wolfgangp, jakehehrlich, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D65384

llvm-svn: 368464
---
 llvm/docs/CommandGuide/llvm-strip.md  |  16 ----
 llvm/docs/CommandGuide/llvm-strip.rst | 167 ++++++++++++++++++++++++++++++++++
 2 files changed, 167 insertions(+), 16 deletions(-)
 delete mode 100644 llvm/docs/CommandGuide/llvm-strip.md
 create mode 100644 llvm/docs/CommandGuide/llvm-strip.rst

diff --git a/llvm/docs/CommandGuide/llvm-strip.md b/llvm/docs/CommandGuide/llvm-strip.md
deleted file mode 100644
index dd6e859..0000000
--- a/llvm/docs/CommandGuide/llvm-strip.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# llvm-strip - object stripping tool
-
-## SYNOPSIS
-
-**llvm-strip** [*options*]
-
-## DESCRIPTION
-
-**llvm-strip** is a tool to strip sections and symbols from object files.
-
-The tool is still in active development, but in most scenarios it works as a
-drop-in replacement for GNU's **strip**.
-
-## SEE ALSO
-
-[llvm-objcopy](llvm-objcopy.html)
diff --git a/llvm/docs/CommandGuide/llvm-strip.rst b/llvm/docs/CommandGuide/llvm-strip.rst
new file mode 100644
index 0000000..6e02482
--- /dev/null
+++ b/llvm/docs/CommandGuide/llvm-strip.rst
@@ -0,0 +1,167 @@
+llvm-strip - object stripping tool
+==================================
+
+.. program:: llvm-strip
+
+SYNOPSIS
+--------
+
+:program:`llvm-strip` [*options*] *inputs...*
+
+DESCRIPTION
+-----------
+
+:program:`llvm-strip` is a tool to strip sections and symbols from object files.
+If no other stripping or remove options are specified, :option:`--strip-all`
+will be enabled by default.
+
+The input files are modified in-place. If "-" is specified for the input file,
+the input is read from the program's standard input stream.
+
+If the input is an archive, any requested operations will be applied to each
+archive member individually.
+
+The tool is still in active development, but in most scenarios it works as a
+drop-in replacement for GNU's :program:`strip`.
+
+GENERIC AND CROSS-PLATFORM OPTIONS
+----------------------------------
+
+The following options are either agnostic of the file format, or apply to
+multiple file formats.
+
+.. option:: --disable-deterministic-archives, -U
+
+ Use real values for UIDs, GIDs and timestamps when updating archive member
+ headers.
+
+.. option:: --discard-all, -x
+
+ Remove most local symbols from the output. Different file formats may limit
+ this to a subset of the local symbols. For example, file and section symbols in
+ ELF objects will not be discarded.
+
+.. option::  --enable-deterministic-archives, -D
+
+ Enable deterministic mode when stripping archives, i.e. use 0 for archive member
+ header UIDs, GIDs and timestamp fields. On by default.
+
+.. option:: --help, -h
+
+ Print a summary of command line options.
+
+.. option::  --no-strip-all
+
+ Disable --strip-all.
+
+.. option::  -o <file>
+
+ Write output to <file>. Multiple input files cannot be used in combination
+ with -o.
+
+.. option:: --regex
+
+ If specified, symbol and section names specified by other switches are treated
+ as extended POSIX regular expression patterns.
+
+.. option:: --remove-section <section>, -R
+
+ Remove the specified section from the output. Can be specified multiple times
+ to remove multiple sections simultaneously.
+
+.. option:: --strip-all-gnu
+
+ Remove all symbols, debug sections and relocations from the output. This option
+ is equivalent to GNU :program:`strip`'s ``--strip-all`` switch.
+
+.. option:: --strip-all, -S
+
+ For ELF objects, remove from the output all symbols and non-alloc sections not
+ within segments, except for .gnu.warning sections and the section name table.
+
+ For COFF objects, remove all symbols, debug sections, and relocations from the
+ output.
+
+.. option:: --strip-debug, -g
+
+ Remove all debug sections.
+
+.. option:: --strip-sections
+
+ Remove all section headers and all sections not in segments.
+
+.. option:: --strip-symbol <symbol>, -N
+
+ Remove all symbols named ``<symbol>`` from the output. Can be specified
+ multiple times to remove multiple symbols.
+
+.. option:: --strip-unneeded
+
+ Remove all local or undefined symbols that are not required by relocations.
+
+.. option:: --version, -V
+
+  Display the version of this program.
+
+COFF-SPECIFIC OPTIONS
+---------------------
+
+The following options are implemented only for COFF objects. If used with other
+objects, :program:`llvm-strip` will either emit an error or silently ignore
+them.
+
+.. option:: --only-keep-debug
+
+ Remove the contents of non-debug sections from the output, but keep the section
+ headers.
+
+ELF-SPECIFIC OPTIONS
+--------------------
+
+The following options are implemented only for ELF objects. If used with other
+objects, :program:`llvm-strip` will either emit an error or silently ignore
+them.
+
+.. option:: --allow-broken-links
+
+ Allow llvm-strip to remove sections even if it would leave invalid section
+ references. Any invalid sh_link fields will be set to zero.
+
+.. option:: --discard-locals, -X
+
+ Remove local symbols starting with ".L" from the output.
+
+.. option:: --keep-file-symbols
+
+ Keep symbols of type `STT_FILE`, even if they would otherwise be stripped.
+
+ .. option:: --keep-section <section>
+
+ When removing sections from the output, do not remove sections named
+ ``<section>``. Can be specified multiple times to keep multiple sections.
+
+.. option:: --keep-symbol <symbol>, -K
+
+ Do not remove symbols named ``<symbol>``. Can be specified multiple times to
+ keep multiple symbols.
+
+.. option::  --preserve-dates, -p
+
+ Preserve access and modification timestamps.
+
+
+EXIT STATUS
+-----------
+
+:program:`llvm-strip` exits with a non-zero exit code if there is an error.
+Otherwise, it exits with code 0.
+
+BUGS
+----
+
+To report bugs, please visit <http://llvm.org/bugs/>.
+
+SEE ALSO
+--------
+
+:manpage:`llvm-objcopy(1)`
-- 
1.8.3.1