session: add split-dwarf flag

This commit adds a flag for Split DWARF, which enables debuginfo to be
split into multiple files.

Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
David Wood 2020-09-23 16:50:58 +01:00
parent 341aa97adb
commit 57d05d3576
No known key found for this signature in database
GPG Key ID: 2592E76C87381FD9
2 changed files with 36 additions and 0 deletions

View File

@ -221,6 +221,23 @@ pub enum DebugInfo {
Full,
}
/// Some debuginfo requires link-time relocation and some does not. LLVM can partition the debuginfo
/// into sections depending on whether or not it requires link-time relocation. Split DWARF
/// provides a mechanism which allows the linker to skip the sections which don't require link-time
/// relocation - either by putting those sections into DWARF object files, or keeping them in the
/// object file in such a way that the linker will skip them.
#[derive(Clone, Copy, Debug, PartialEq, Hash)]
pub enum SplitDwarfKind {
/// Disabled.
None,
/// Sections which do not require relocation are written into the object file but ignored
/// by the linker.
Single,
/// Sections which do not require relocation are written into a DWARF object (`.dwo`) file,
/// which is skipped by the linker by virtue of being a different file.
Split,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, PartialOrd, Ord)]
#[derive(Encodable, Decodable)]
pub enum OutputType {

View File

@ -269,6 +269,7 @@ mod $mod_desc {
pub const parse_switch_with_opt_path: &str =
"an optional path to the profiling data output directory";
pub const parse_merge_functions: &str = "one of: `disabled`, `trampolines`, or `aliases`";
pub const parse_split_dwarf_kind: &str = "one of: `none`, `single` or `split`";
pub const parse_symbol_mangling_version: &str = "either `legacy` or `v0` (RFC 2603)";
pub const parse_src_file_hash: &str = "either `md5` or `sha1`";
pub const parse_relocation_model: &str =
@ -676,6 +677,19 @@ fn parse_tls_model(slot: &mut Option<TlsModel>, v: Option<&str>) -> bool {
true
}
fn parse_split_dwarf_kind(
slot: &mut SplitDwarfKind,
v: Option<&str>,
) -> bool {
*slot = match v {
Some("none") => SplitDwarfKind::None,
Some("split") => SplitDwarfKind::Split,
Some("single") => SplitDwarfKind::Single,
_ => return false,
};
true
}
fn parse_symbol_mangling_version(
slot: &mut Option<SymbolManglingVersion>,
v: Option<&str>,
@ -1088,6 +1102,11 @@ fn parse_target_feature(slot: &mut String, v: Option<&str>) -> bool {
"hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`)"),
strip: Strip = (Strip::None, parse_strip, [UNTRACKED],
"tell the linker which information to strip (`none` (default), `debuginfo` or `symbols`)"),
split_dwarf: SplitDwarfKind = (SplitDwarfKind::None, parse_split_dwarf_kind, [UNTRACKED],
"enable generation of split dwarf"),
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"),
symbol_mangling_version: Option<SymbolManglingVersion> = (None,
parse_symbol_mangling_version, [TRACKED],
"which mangling version to use for symbol names ('legacy' (default) or 'v0')"),