mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
llvm: dwo only emitted when object code emitted
`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). Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
9bcc083c87
commit
29dc08307d
@ -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,
|
||||
))
|
||||
|
@ -53,7 +53,7 @@ off:
|
||||
[ ! -f $(TMPDIR)/*.dwp ]
|
||||
[ ! -f $(TMPDIR)/*.dwo ]
|
||||
|
||||
packed: packed-split packed-single packed-remapped packed-crosscrate
|
||||
packed: packed-split packed-single packed-lto packed-remapped packed-crosscrate
|
||||
|
||||
# - Debuginfo in `.dwo` files
|
||||
# - `.o` deleted
|
||||
@ -77,6 +77,32 @@ packed-single:
|
||||
rm $(TMPDIR)/foo.dwp
|
||||
rm $(TMPDIR)/$(call BIN,foo)
|
||||
|
||||
packed-lto: packed-lto-split packed-lto-single
|
||||
|
||||
# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated
|
||||
# - `.o` never created
|
||||
# - `.dwo` never created
|
||||
# - `.dwp` never created
|
||||
packed-lto-split:
|
||||
$(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=split \
|
||||
--crate-type=rlib -Clinker-plugin-lto
|
||||
ls $(TMPDIR)/*.o && exit 1 || exit 0
|
||||
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
|
||||
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
|
||||
rm $(TMPDIR)/libbaz.rlib
|
||||
|
||||
# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated
|
||||
# - `.o` never created
|
||||
# - `.dwo` never created
|
||||
# - `.dwp` never created
|
||||
packed-lto-single:
|
||||
$(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=packed -Zsplit-dwarf-kind=single \
|
||||
--crate-type=rlib -Clinker-plugin-lto
|
||||
ls $(TMPDIR)/*.o && exit 1 || exit 0
|
||||
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
|
||||
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
|
||||
rm $(TMPDIR)/libbaz.rlib
|
||||
|
||||
packed-remapped: packed-remapped-split packed-remapped-single
|
||||
|
||||
# - Debuginfo in `.dwo` files
|
||||
@ -153,7 +179,7 @@ packed-crosscrate-single:
|
||||
rm $(TMPDIR)/main.dwp
|
||||
rm $(TMPDIR)/$(call BIN,main)
|
||||
|
||||
unpacked: unpacked-split unpacked-single unpacked-remapped unpacked-crosscrate
|
||||
unpacked: unpacked-split unpacked-single unpacked-lto unpacked-remapped unpacked-crosscrate
|
||||
|
||||
# - Debuginfo in `.dwo` files
|
||||
# - `.o` deleted
|
||||
@ -177,6 +203,32 @@ unpacked-single:
|
||||
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
|
||||
rm $(TMPDIR)/$(call BIN,foo)
|
||||
|
||||
unpacked-lto: packed-lto-split packed-lto-single
|
||||
|
||||
# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated
|
||||
# - `.o` never created
|
||||
# - `.dwo` never created
|
||||
# - `.dwp` never created
|
||||
unpacked-lto-split:
|
||||
$(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=split \
|
||||
--crate-type=rlib -Clinker-plugin-lto
|
||||
ls $(TMPDIR)/*.o && exit 1 || exit 0
|
||||
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
|
||||
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
|
||||
rm $(TMPDIR)/libbaz.rlib
|
||||
|
||||
# - rmeta file added to rlib, no object files are generated and thus no debuginfo is generated
|
||||
# - `.o` never created
|
||||
# - `.dwo` never created
|
||||
# - `.dwp` never created
|
||||
unpacked-lto-single:
|
||||
$(RUSTC) baz.rs -g $(UNSTABLEOPTS) -Csplit-debuginfo=unpacked -Zsplit-dwarf-kind=single \
|
||||
--crate-type=rlib -Clinker-plugin-lto
|
||||
ls $(TMPDIR)/*.o && exit 1 || exit 0
|
||||
ls $(TMPDIR)/*.dwo && exit 1 || exit 0
|
||||
ls $(TMPDIR)/*.dwp && exit 1 || exit 0
|
||||
rm $(TMPDIR)/libbaz.rlib
|
||||
|
||||
unpacked-remapped: unpacked-remapped-split unpacked-remapped-single
|
||||
|
||||
# - Debuginfo in `.dwo` files
|
||||
|
1
src/test/run-make-fulldeps/split-debuginfo/baz.rs
Normal file
1
src/test/run-make-fulldeps/split-debuginfo/baz.rs
Normal file
@ -0,0 +1 @@
|
||||
// empty
|
Loading…
Reference in New Issue
Block a user