1
Fork 0

Restore #![no_builtins] crates participation in LTO.

After #113716, we can make `#![no_builtins]` crates participate in LTO again.
`#![no_builtins]` with LTO does not result in undefined references to the error.
This commit is contained in:
DianQK 2023-08-10 16:51:03 +08:00
parent e20cb77021
commit 520081721c
No known key found for this signature in database
GPG key ID: 46BDB1AC96C48912
8 changed files with 108 additions and 58 deletions

View file

@ -885,9 +885,7 @@ impl CrateInfo {
// If global LTO is enabled then almost everything (*) is glued into a single object file,
// so this logic is not necessary and can cause issues on some targets (due to weak lang
// item symbols being "privatized" to that object file), so we disable it.
// (*) Native libs, and `#[compiler_builtins]` and `#[no_builtins]` crates are not glued,
// and we assume that they cannot define weak lang items. This is not currently enforced
// by the compiler, but that's ok because all this stuff is unstable anyway.
// (*) Native libs are not glued, and we assume that they cannot define weak lang items.
let target = &tcx.sess.target;
if !are_upstream_rust_objects_already_included(tcx.sess) {
let missing_weak_lang_items: FxHashSet<Symbol> = info