Skip to content

Commit

Permalink
Document fat LTO and codegen unit solution
Browse files Browse the repository at this point in the history
Occassionally thin LTO isn't enough, and one needs to leverage fat LTO
and a single codegen unit in order for no_panic to succeed. [See PR][0]
where both are needed.

[0]: nickbabcock/highway-rs#78
  • Loading branch information
nickbabcock committed Jan 20, 2024
1 parent 5f2f9b4 commit f60df10
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ enabled for the linker to deduce those do not panic.
lto = "thin"
```

If thin LTO doesn't work, the next step would be to try fat LTO with a single
codegen unit:

```toml
[profile.release]
lto = "fat"
codegen-units = 1
```

If you want no\_panic to just assume that some function you call doesn't panic,
and get Undefined Behavior if it does at runtime, see [dtolnay/no-panic#16]; try
wrapping that call in an `unsafe extern "C"` wrapper.
Expand Down

0 comments on commit f60df10

Please sign in to comment.