Skip to content

Commit

Permalink
CI: build with a single codegen unit
Browse files Browse the repository at this point in the history
This is not ideal, but it does provide two things:

1. It fixes bizarre linker errors about missing `sancov` symbols.

2. It allows LLVM to do inlining that it otherwise refuses to do. For some
reason, when sanitizers are enabled, LLVM refuses to inline across codegen
units. This is a problem because trivial methods like `Vec::len` won't be
inlined, resulting in 100x slowdowns.

`cargo fuzz` already restricts its builds to a single codegen unit, so we might
as well do the same thing in CI here.
  • Loading branch information
fitzgen committed Mar 3, 2022
1 parent 55faf5a commit d4d1c46
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pushd ./example
cargo rustc \
--release \
-- \
-Ccodegen-units=1 \
-Cpasses=sancov-module \
-Cllvm-args=-sanitizer-coverage-level=3 \
-Cllvm-args=-sanitizer-coverage-trace-compares \
Expand All @@ -26,6 +27,7 @@ pushd ./example_arbitrary
cargo rustc \
--release \
-- \
-Ccodegen-units=1 \
-Cpasses=sancov-module \
-Cllvm-args=-sanitizer-coverage-level=3 \
-Cllvm-args=-sanitizer-coverage-trace-compares \
Expand All @@ -46,6 +48,7 @@ pushd ./example_mutator
cargo rustc \
--release \
-- \
-Ccodegen-units=1 \
-Cpasses=sancov-module \
-Cllvm-args=-sanitizer-coverage-level=3 \
-Cllvm-args=-sanitizer-coverage-trace-compares \
Expand Down

0 comments on commit d4d1c46

Please sign in to comment.