Auto merge of #118568 - DianQK:no-builtins-symbols, r=pnkfelix
Avoid adding builtin functions to `symbols.o`
We found performance regressions in #113923. The problem seems to be that `--gc-sections` does not remove these symbols. I tested that lld removes these symbols, but ld and gold do not.
I found that `used` adds symbols to `symbols.o` at 3e202ead60/compiler/rustc_codegen_ssa/src/back/linker.rs (L1786-L1791)
.
The PR removes builtin functions.
Note that under LTO, ld still preserves these symbols. (lld will still remove them.)
The first commit also fixes #118559. But I think the second commit also makes sense.
This commit is contained in:
commit
503e129328
6 changed files with 30 additions and 4 deletions
|
@ -60,7 +60,7 @@ fn prepare_lto(
|
|||
};
|
||||
|
||||
let symbol_filter = &|&(ref name, info): &(String, SymbolExportInfo)| {
|
||||
if info.level.is_below_threshold(export_threshold) || info.used {
|
||||
if info.level.is_below_threshold(export_threshold) || info.used || info.used_compiler {
|
||||
Some(CString::new(name.as_str()).unwrap())
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue