Auto merge of #137736 - bjorn3:compiler_builtins_export_fix, r= · rust-lang/rust@c49fce8 (original) (raw)
File tree
1 file changed
lines changed
- compiler/rustc_codegen_ssa/src/back
1 file changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1782,7 +1782,10 @@ fn exported_symbols_for_non_proc_macro(tcx: TyCtxt<'_>, crate_type: CrateType) - | ||
1782 | 1782 | let mut symbols = Vec::new(); |
1783 | 1783 | let export_threshold = symbol_export::crates_export_threshold(&[crate_type]); |
1784 | 1784 | for_each_exported_symbols_include_dep(tcx, crate_type, |symbol, info, cnum |
1785 | -if info.level.is_below_threshold(export_threshold) { | |
1785 | +// Do not export mangled symbols from cdylibs and don't attempt to export compiler-builtins | |
1786 | +// from any cdylib. The latter doesn't work anyway as we use hidden visibility for | |
1787 | +// compiler-builtins. Most linkers silently ignore it, but ld64 gives a warning. | |
1788 | +if info.level.is_below_threshold(export_threshold) && !tcx.is_compiler_builtins(cnum) { | |
1786 | 1789 | symbols.push(symbol_export::exporting_symbol_name_for_instance_in_crate( |
1787 | 1790 | tcx, symbol, cnum, |
1788 | 1791 | )); |
@@ -1821,7 +1824,9 @@ pub(crate) fn linked_symbols( | ||
1821 | 1824 | |
1822 | 1825 | let export_threshold = symbol_export::crates_export_threshold(&[crate_type]); |
1823 | 1826 | for_each_exported_symbols_include_dep(tcx, crate_type, |symbol, info, cnum |
1824 | -if info.level.is_below_threshold(export_threshold) | | |
1827 | +if info.level.is_below_threshold(export_threshold) && !tcx.is_compiler_builtins(cnum) | |
1828 | + | | |
1829 | +{ | |
1825 | 1830 | symbols.push(( |
1826 | 1831 | symbol_export::linking_symbol_name_for_instance_in_crate(tcx, symbol, cnum), |
1827 | 1832 | info.kind, |