rust-ctor icon indicating copy to clipboard operation
rust-ctor copied to clipboard

lld 9.0 appears to be optimizing out ctor

Open jaynus opened this issue 5 years ago • 3 comments

This seems possibly related to dtolnay/inventory#11.

After upgrading to LLVM 9.0.1, it appears my registrations with the inventory crate, using ctor, have dissapeared. Reverting back to LLVM 8.0 resolves the issue.

Specifically, it appears if code in the module is not used, ctor does not run. This wasn't previously the case, so appears to be a new optimization cutting out the registrations from unused modules.

jaynus avatar Feb 13 '20 18:02 jaynus

This sounds a bit like #27

mmastrac avatar Feb 13 '20 18:02 mmastrac

I should clarify; in my case, these are 2 seperate module files in the same crate

jaynus avatar Feb 13 '20 18:02 jaynus

Is this still an issue these days?

mmastrac avatar Sep 01 '21 21:09 mmastrac

Closing for now -- #280 may have a solution for +nightly users.

mmastrac avatar May 30 '23 19:05 mmastrac