From d4d1c46b54690ee5d6686d49e6316c1031806d28 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 3 Mar 2022 09:18:28 -0800 Subject: [PATCH] CI: build with a single codegen unit 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. --- ci/script.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/script.sh b/ci/script.sh index 46e82c1..03f71c3 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -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 \ @@ -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 \ @@ -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 \