about summary refs log tree commit diff
path: root/src/doc/rustc
diff options
context:
space:
mode:
authorSam Elliott <selliott@lowrisc.org>2020-05-04 12:08:35 +0100
committerSam Elliott <selliott@lowrisc.org>2020-05-04 12:08:35 +0100
commitcda994633ee109639b9c4c12c20e2aacb6a879cd (patch)
tree29f36af9ce8b3325f8cd92818e5ef74fe3780adc /src/doc/rustc
parentd626e4dadc37d7027d65f087da0ad1ddb460959f (diff)
downloadrust-cda994633ee109639b9c4c12c20e2aacb6a879cd.tar.gz
rust-cda994633ee109639b9c4c12c20e2aacb6a879cd.zip
Add Option to Force Unwind Tables
When panic != unwind, `nounwind` is added to all functions for a target.
This can cause issues when a panic happens with RUST_BACKTRACE=1, as
there needs to be a way to reconstruct the backtrace. There are three
possible sources of this information: forcing frame pointers (for which
an option exists already), debug info (for which an option exists), or
unwind tables.

Especially for embedded devices, forcing frame pointers can have code
size overheads (RISC-V sees ~10% overheads, ARM sees ~2-3% overheads).
In code, it can be the case that debug info is not kept, so it is useful
to provide this third option, unwind tables, that users can use to
reconstruct the call stack. Reconstructing this stack is harder than
with frame pointers, but it is still possible.

This commit adds a compiler option which allows a user to force the
addition of unwind tables. Unwind tables cannot be disabled on targets
that require them for correctness, or when using `-C panic=unwind`.
Diffstat (limited to 'src/doc/rustc')
-rw-r--r--src/doc/rustc/src/codegen-options/index.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/doc/rustc/src/codegen-options/index.md b/src/doc/rustc/src/codegen-options/index.md
index 08b5ab10817..4ffa6207b97 100644
--- a/src/doc/rustc/src/codegen-options/index.md
+++ b/src/doc/rustc/src/codegen-options/index.md
@@ -98,6 +98,18 @@ values:
 The default behaviour, if frame pointers are not force-enabled, depends on the
 target.
 
+## force-unwind-tables
+
+This flag forces the generation of unwind tables. It takes one of the following
+values:
+
+* `y`, `yes`, `on`, or no value: Unwind tables are forced to be generated.
+* `n`, `no`, or `off`: Unwind tables are not forced to be generated. If unwind
+  tables are required by the target or `-C panic=unwind`, an error will be
+  emitted.
+
+The default if not specified depends on the target.
+
 ## incremental
 
 This flag allows you to enable incremental compilation, which allows `rustc`