Skip to content

staticlib + sancov + full LTO fails with 1.56 #90300

Open
@glandium

Description

@glandium

Code

For a reduced-ish testcase, create a lib with the following Cargo.toml:

[package]
name = "testcase"
version = "0.1.0"

[lib]
crate-type = ["staticlib"]
path = "lib.rs"

[dependencies]
wast = { version = "38.0.1" }

profile.release]
lto = true

and lib.rs:

extern crate wast;

The following command fails:

$ RUSTFLAGS="-Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cembed-bitcode=yes" cargo build  --release
   Compiling leb128 v0.2.5
   Compiling wast v38.0.1
   Compiling testcase v0.1.0 (/tmp/testcase)
warning: Linking COMDATs named '_ZN4core3ptr66drop_in_place$LT$alloc..vec..Vec$LT$wast..ast..func..Local$GT$$GT$17h37651afa29ff204cE': nodeduplicate has been violated!

error: failed to load bc of "wast-c09551a471674a65.wast.553280a2-cgu.1.rcgu.o": 

This worked fine up to 1.55. This fails with 1.56. Values of -sanitizer-coverage-level between 1 and 4 fail.

It also fails with nightly (but -Cpasses=sancov needs to be replaced with -Cpasses=sancov-module), and the error message is slightly different:

warning: Linking COMDATs named '_ZN4core3ptr79drop_in_place$LT$core..option..Option$LT$wast..ast..types..FunctionType$GT$$GT$17he370b2da7c4642faE': GlobalVariable required for data dependent selection!

error: failed to load bc of "wast-262865a11263ff3e.wast.a15963cd-cgu.1.rcgu.o": 

Disabling LTO or using thin LTO makes it work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-LTOArea: Link-time optimization (LTO)C-bugCategory: This is a bug.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions