linkme icon indicating copy to clipboard operation
linkme copied to clipboard

Opt-out of duplicate check

Open rich-ayr opened this issue 1 year ago • 0 comments

Based on the discussion in #3, it seems that when you declare a distributed_slice within a library it automatically gets prefixed with the crate's name, thus the duplicate check shouldn't be necessary. It appears however that the inclusion of multiple semvers of the crate can result in duplicate declarations.

Unfortunately, the duplicate check has two unwanted consequences: an extra .linkm2_ section as well as a potential panic!. I tried adding println!("cargo:rustc-link-arg-bins=/MERGE:.linkme_=.data,.linkm2_=.rdata") to the build.rs script in an attempt to get rid of the section(s), but that didn't seem to have any effect.

It would be helpful to have a feature flag, like no_dupcheck, to conditionally opt-out of the duplicate checks introduced in #53 when creating a release build.

Also, is there any way to prevent multiple semvers from causing duplicate slices in the first place?

rich-ayr avatar Sep 01 '24 06:09 rich-ayr