Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cce6231

Browse files
authored
Rollup merge of rust-lang#146133 - rcvalle:rust-cfi-fix-145981, r=bjorn3
Revert "Make `lto` and `linker-plugin-lto` work the same for `compiler_builtins` This reverts commit cf8753e and fix the regressions reported at rust-lang#145981 and rust-lang#146109.
2 parents c58ec60 + 916b55e commit cce6231

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

‎compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,23 @@ impl ModuleConfig {
138138

139139
let emit_obj = if !should_emit_obj {
140140
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+
{
142144
// This case is selected if the target uses objects as bitcode, or
143145
// if linker plugin LTO is enabled. In the linker plugin LTO case
144146
// the assumption is that the final link-step will read the bitcode
145147
// and convert it to object code. This may be done by either the
146148
// 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.
147158
EmitObj::Bitcode
148159
} else if need_bitcode_in_object(tcx) {
149160
EmitObj::ObjectCode(BitcodeSection::Full)

‎tests/ui/sanitizer/cfi/no_builtins.rs

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /