diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2022-11-13 21:49:25 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-13 21:49:25 -0500 |
| commit | e284780cf64381eeb0379d09a6f4896b239db9b1 (patch) | |
| tree | e5852b873de6163b95cbb6ff65f9b13eaba5ee1e /compiler/rustc_codegen_llvm/src | |
| parent | c9fc5cbeb5b682eb207cb190670027c497ea47a1 (diff) | |
| parent | 29dc08307dde3051ab6bf17c53f2db99e32681ee (diff) | |
| download | rust-e284780cf64381eeb0379d09a6f4896b239db9b1.tar.gz rust-e284780cf64381eeb0379d09a6f4896b239db9b1.zip | |
Rollup merge of #104105 - davidtwco:split-dwarf-lto, r=michaelwoerister
llvm: dwo only emitted when object code emitted Fixes #103932. `CompiledModule` should not think a DWARF object was emitted when a bitcode-only compilation has happened, this can confuse archive file creation (which expects to create an archive containing non-existent dwo files). r? ``````@michaelwoerister``````
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/write.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 11053a8f6c4..97d0de47b3a 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -765,11 +765,21 @@ pub(crate) unsafe fn codegen( drop(handlers); } + // `.dwo` files are only emitted if: + // + // - Object files are being emitted (i.e. bitcode only or metadata only compilations will not + // produce dwarf objects, even if otherwise enabled) + // - Target supports Split DWARF + // - Split debuginfo is enabled + // - Split DWARF kind is `split` (i.e. debuginfo is split into `.dwo` files, not different + // sections in the `.o` files). + let dwarf_object_emitted = matches!(config.emit_obj, EmitObj::ObjectCode(_)) + && cgcx.target_can_use_split_dwarf + && cgcx.split_debuginfo != SplitDebuginfo::Off + && cgcx.split_dwarf_kind == SplitDwarfKind::Split; Ok(module.into_compiled_module( config.emit_obj != EmitObj::None, - cgcx.target_can_use_split_dwarf - && cgcx.split_debuginfo != SplitDebuginfo::Off - && cgcx.split_dwarf_kind == SplitDwarfKind::Split, + dwarf_object_emitted, config.emit_bc, &cgcx.output_filenames, )) |
