File tree Expand file tree Collapse file tree 2 files changed +12
-23
lines changed
compiler/rustc_codegen_ssa/src/back Expand file tree Collapse file tree 2 files changed +12
-23
lines changed Original file line number Diff line number Diff line change @@ -138,12 +138,23 @@ impl ModuleConfig {
138
138
139
139
let emit_obj = if !should_emit_obj {
140
140
EmitObj :: None
141
- } else if sess. target . obj_is_bitcode || sess. opts . cg . linker_plugin_lto . enabled ( ) {
141
+ } else if sess. target . obj_is_bitcode
142
+ || ( sess. opts . cg . linker_plugin_lto . enabled ( ) && !no_builtins)
143
+ {
142
144
// This case is selected if the target uses objects as bitcode, or
143
145
// if linker plugin LTO is enabled. In the linker plugin LTO case
144
146
// the assumption is that the final link-step will read the bitcode
145
147
// and convert it to object code. This may be done by either the
146
148
// native linker or rustc itself.
149
+ //
150
+ // Note, however, that the linker-plugin-lto requested here is
151
+ // explicitly ignored for `#![no_builtins]` crates. These crates are
152
+ // specifically ignored by rustc's LTO passes and wouldn't work if
153
+ // loaded into the linker. These crates define symbols that LLVM
154
+ // lowers intrinsics to, and these symbol dependencies aren't known
155
+ // until after codegen. As a result any crate marked
156
+ // `#![no_builtins]` is assumed to not participate in LTO and
157
+ // instead goes on to generate object code.
147
158
EmitObj :: Bitcode
148
159
} else if need_bitcode_in_object ( tcx) {
149
160
EmitObj :: ObjectCode ( BitcodeSection :: Full )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments