sess/cg: re-introduce split dwarf kind
In #79570, `-Z split-dwarf-kind={none,single,split}` was replaced by `-C split-debuginfo={off,packed,unpacked}`. `-C split-debuginfo`'s packed and unpacked aren't exact parallels to single and split, respectively. On Unix, `-C split-debuginfo=packed` will put debuginfo into object files and package debuginfo into a DWARF package file (`.dwp`) and `-C split-debuginfo=unpacked` will put debuginfo into dwarf object files and won't package it. In the initial implementation of Split DWARF, split mode wrote sections which did not require relocation into a DWARF object (`.dwo`) file which was ignored by the linker and then packaged those DWARF objects into DWARF packages (`.dwp`). In single mode, sections which did not require relocation were written into object files but ignored by the linker and were not packaged. However, both split and single modes could be packaged or not, the primary difference in behaviour was where the debuginfo sections that did not require link-time relocation were written (in a DWARF object or the object file). This commit re-introduces a `-Z split-dwarf-kind` flag, which can be used to pick between split and single modes when `-C split-debuginfo` is used to enable Split DWARF (either packed or unpacked). Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
f1ce0e6a00
commit
08ed338f56
8 changed files with 184 additions and 61 deletions
|
@ -412,6 +412,8 @@ mod desc {
|
|||
pub const parse_wasi_exec_model: &str = "either `command` or `reactor`";
|
||||
pub const parse_split_debuginfo: &str =
|
||||
"one of supported split-debuginfo modes (`off`, `packed`, or `unpacked`)";
|
||||
pub const parse_split_dwarf_kind: &str =
|
||||
"one of supported split dwarf modes (`split` or `single`)";
|
||||
pub const parse_gcc_ld: &str = "one of: no value, `lld`";
|
||||
pub const parse_stack_protector: &str =
|
||||
"one of (`none` (default), `basic`, `strong`, or `all`)";
|
||||
|
@ -941,6 +943,14 @@ mod parse {
|
|||
true
|
||||
}
|
||||
|
||||
crate fn parse_split_dwarf_kind(slot: &mut SplitDwarfKind, v: Option<&str>) -> bool {
|
||||
match v.and_then(|s| SplitDwarfKind::from_str(s).ok()) {
|
||||
Some(e) => *slot = e,
|
||||
_ => return false,
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
crate fn parse_gcc_ld(slot: &mut Option<LdImpl>, v: Option<&str>) -> bool {
|
||||
match v {
|
||||
None => *slot = None,
|
||||
|
@ -1403,6 +1413,14 @@ options! {
|
|||
"control stack smash protection strategy (`rustc --print stack-protector-strategies` for details)"),
|
||||
strip: Strip = (Strip::None, parse_strip, [UNTRACKED],
|
||||
"tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`)"),
|
||||
split_dwarf_kind: SplitDwarfKind = (SplitDwarfKind::Split, parse_split_dwarf_kind, [UNTRACKED],
|
||||
"split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform)
|
||||
(default: `split`)
|
||||
|
||||
`split`: sections which do not require relocation are written into a DWARF object (`.dwo`)
|
||||
file which is ignored by the linker
|
||||
`single`: sections which do not require relocation are written into object file but ignored
|
||||
by the linker"),
|
||||
split_dwarf_inlining: bool = (true, parse_bool, [UNTRACKED],
|
||||
"provide minimal debug info in the object/executable to facilitate online \
|
||||
symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue