Apply weak attributes to all intrinsics by Amjad50 · Pull Request #598 · rust-lang/compiler-builtins (original) (raw)

Removed the weak-intrinsics feature, so that all functions will have the weak linkage attribute.

But this caused issues for memset (maybe other mem functions are related), so added a special feature for those mem-weak-intrinsics.

mem functions won't have the weak attribute unless this feature is enabled.

This also fixed the bug in rust-lang/rust#124042.

Before this commit, generated code will be

pub extern "C" fn (...) -> ... { // code... } pub mod { #[linkage = "weak"] #[no_mangle] pub extern "C" fn (...) -> ... { super::(...) } }

The issue is that there is 2 weak linkage, the first one is not required. Along refactoring weak attributes, this was fixed.