about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-02 07:39:10 +0000
committerbors <bors@rust-lang.org>2024-04-02 07:39:10 +0000
commit2531d08e342f21f83eef90741c871f32ba7aa7d2 (patch)
tree2d3119063b49f23783f109ba006da9028cfa8335
parente2cf2cb30388385f0fe6b406a31a3f9841a72a62 (diff)
parent1dcaf70c0e114aabb116114dac521f1014204527 (diff)
downloadrust-2531d08e342f21f83eef90741c871f32ba7aa7d2.tar.gz
rust-2531d08e342f21f83eef90741c871f32ba7aa7d2.zip
Auto merge of #123336 - workingjubilee:strip-the-trace-off-my-back, r=Nilstrieb
Note impact of `-Cstrip` on backtraces

It is not always clear to people what the impact of `-Cstrip` options are. They are a common question on sites like StackOverflow, and sometimes people even report bugs with "no backtrace" after deliberately mangling the symbol table. We cannot exhaustively document every permutation, but we should warn people about common effects.
-rw-r--r--src/doc/rustc/src/codegen-options/index.md14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md
index 4a4f1ae98e4..c8f5d649570 100644
--- a/src/doc/rustc/src/codegen-options/index.md
+++ b/src/doc/rustc/src/codegen-options/index.md
@@ -553,9 +553,17 @@ Supported values for this option are:
   of MSVC).
 - `debuginfo` - debuginfo sections and debuginfo symbols from the symbol table
   section are stripped at link time and are not copied to the produced binary
-  or separate files.
-- `symbols` - same as `debuginfo`, but the rest of the symbol table section is
-  stripped as well if the linker supports it.
+  or separate files. This should leave backtraces mostly-intact but may make
+  using a debugger like gdb or lldb ineffectual.
+- `symbols` - same as `debuginfo`, but the rest of the symbol table section is stripped as well,
+  depending on platform support. On platforms which depend on this symbol table for backtraces,
+  profiling, and similar, this can affect them so negatively as to make the trace incomprehensible.
+  Programs which may be combined with others, such as CLI pipelines and developer tooling,
+  or even anything which wants crash-reporting, should usually avoid `-Cstrip=symbols`.
+
+Note that, at any level, removing debuginfo only necessarily impacts "friendly" introspection.
+`-Cstrip` cannot be relied on as a meaningful security or obfuscation measure, as disassemblers
+and decompilers can extract considerable information even in the absence of symbols.
 
 ## symbol-mangling-version