How to check if building code with/without LTO and panic=abort/unwind?

Inside the main source files you can use cfg!(panic = "abort"). As for LTO you need to use a build script and check if the CARGO_ENCODED_RUSTFLAGS env var contains -Clto.

2 Likes