Auto merge of #81493 - JohnTitor:rollup-sa4m4zh, r=JohnTitor
Rollup of 10 pull requests Successful merges: - #79570 (rustc: Stabilize `-Zrun-dsymutil` as `-Csplit-debuginfo`) - #79819 (Add `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lint) - #79991 (rustdoc: Render HRTB correctly for bare functions) - #80215 (Use -target when linking binaries for Mac Catalyst) - #81158 (Point to span of upvar making closure FnMut) - #81176 (Improve safety of `LateContext::qpath_res`) - #81287 (Split rustdoc JSON types into separately versioned crate) - #81306 (Fuse inner iterator in FlattenCompat and improve related tests) - #81333 (clean up some const error reporting around promoteds) - #81459 (Fix rustdoc text selection for page titles) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
74500b9978
90 changed files with 979 additions and 442 deletions
|
@ -1,6 +1,6 @@
|
|||
use std::env;
|
||||
|
||||
use crate::spec::{LinkArgs, TargetOptions};
|
||||
use crate::spec::{LinkArgs, SplitDebuginfo, TargetOptions};
|
||||
|
||||
pub fn opts(os: &str) -> TargetOptions {
|
||||
// ELF TLS is only available in macOS 10.7+. If you try to compile for 10.6
|
||||
|
@ -36,6 +36,10 @@ pub fn opts(os: &str) -> TargetOptions {
|
|||
emit_debug_gdb_scripts: false,
|
||||
eh_frame_header: false,
|
||||
|
||||
// The historical default for macOS targets is to run `dsymutil` which
|
||||
// generates a packed version of debuginfo split from the main file.
|
||||
split_debuginfo: SplitDebuginfo::Packed,
|
||||
|
||||
// This environment variable is pretty magical but is intended for
|
||||
// producing deterministic builds. This was first discovered to be used
|
||||
// by the `ar` tool as a way to control whether or not mtime entries in
|
||||
|
|
|
@ -448,6 +448,69 @@ impl fmt::Display for LinkOutputKind {
|
|||
|
||||
pub type LinkArgs = BTreeMap<LinkerFlavor, Vec<String>>;
|
||||
|
||||
#[derive(Clone, Copy, Hash, Debug, PartialEq, Eq)]
|
||||
pub enum SplitDebuginfo {
|
||||
/// Split debug-information is disabled, meaning that on supported platforms
|
||||
/// you can find all debug information in the executable itself. This is
|
||||
/// only supported for ELF effectively.
|
||||
///
|
||||
/// * Windows - not supported
|
||||
/// * macOS - don't run `dsymutil`
|
||||
/// * ELF - `.dwarf_*` sections
|
||||
Off,
|
||||
|
||||
/// Split debug-information can be found in a "packed" location separate
|
||||
/// from the final artifact. This is supported on all platforms.
|
||||
///
|
||||
/// * Windows - `*.pdb`
|
||||
/// * macOS - `*.dSYM` (run `dsymutil`)
|
||||
/// * ELF - `*.dwp` (run `rust-llvm-dwp`)
|
||||
Packed,
|
||||
|
||||
/// Split debug-information can be found in individual object files on the
|
||||
/// filesystem. The main executable may point to the object files.
|
||||
///
|
||||
/// * Windows - not supported
|
||||
/// * macOS - supported, scattered object files
|
||||
/// * ELF - supported, scattered `*.dwo` files
|
||||
Unpacked,
|
||||
}
|
||||
|
||||
impl SplitDebuginfo {
|
||||
fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
SplitDebuginfo::Off => "off",
|
||||
SplitDebuginfo::Packed => "packed",
|
||||
SplitDebuginfo::Unpacked => "unpacked",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for SplitDebuginfo {
|
||||
type Err = ();
|
||||
|
||||
fn from_str(s: &str) -> Result<SplitDebuginfo, ()> {
|
||||
Ok(match s {
|
||||
"off" => SplitDebuginfo::Off,
|
||||
"unpacked" => SplitDebuginfo::Unpacked,
|
||||
"packed" => SplitDebuginfo::Packed,
|
||||
_ => return Err(()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for SplitDebuginfo {
|
||||
fn to_json(&self) -> Json {
|
||||
self.as_str().to_json()
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for SplitDebuginfo {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str(self.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! supported_targets {
|
||||
( $(($( $triple:literal, )+ $module:ident ),)+ ) => {
|
||||
$(mod $module;)+
|
||||
|
@ -1085,6 +1148,10 @@ pub struct TargetOptions {
|
|||
/// Is true if the target is an ARM architecture using thumb v1 which allows for
|
||||
/// thumb and arm interworking.
|
||||
pub has_thumb_interworking: bool,
|
||||
|
||||
/// How to handle split debug information, if at all. Specifying `None` has
|
||||
/// target-specific meaning.
|
||||
pub split_debuginfo: SplitDebuginfo,
|
||||
}
|
||||
|
||||
impl Default for TargetOptions {
|
||||
|
@ -1184,6 +1251,7 @@ impl Default for TargetOptions {
|
|||
use_ctors_section: false,
|
||||
eh_frame_header: true,
|
||||
has_thumb_interworking: false,
|
||||
split_debuginfo: SplitDebuginfo::Off,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1382,6 +1450,18 @@ impl Target {
|
|||
Some(Ok(()))
|
||||
})).unwrap_or(Ok(()))
|
||||
} );
|
||||
($key_name:ident, SplitDebuginfo) => ( {
|
||||
let name = (stringify!($key_name)).replace("_", "-");
|
||||
obj.find(&name[..]).and_then(|o| o.as_string().and_then(|s| {
|
||||
match s.parse::<SplitDebuginfo>() {
|
||||
Ok(level) => base.$key_name = level,
|
||||
_ => return Some(Err(format!("'{}' is not a valid value for \
|
||||
split-debuginfo. Use 'off' or 'dsymutil'.",
|
||||
s))),
|
||||
}
|
||||
Some(Ok(()))
|
||||
})).unwrap_or(Ok(()))
|
||||
} );
|
||||
($key_name:ident, list) => ( {
|
||||
let name = (stringify!($key_name)).replace("_", "-");
|
||||
if let Some(v) = obj.find(&name).and_then(Json::as_array) {
|
||||
|
@ -1627,6 +1707,7 @@ impl Target {
|
|||
key!(use_ctors_section, bool);
|
||||
key!(eh_frame_header, bool);
|
||||
key!(has_thumb_interworking, bool);
|
||||
key!(split_debuginfo, SplitDebuginfo)?;
|
||||
|
||||
// NB: The old name is deprecated, but support for it is retained for
|
||||
// compatibility.
|
||||
|
@ -1862,6 +1943,7 @@ impl ToJson for Target {
|
|||
target_option_val!(use_ctors_section);
|
||||
target_option_val!(eh_frame_header);
|
||||
target_option_val!(has_thumb_interworking);
|
||||
target_option_val!(split_debuginfo);
|
||||
|
||||
if default.unsupported_abis != self.unsupported_abis {
|
||||
d.insert(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions};
|
||||
use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, SplitDebuginfo, TargetOptions};
|
||||
|
||||
pub fn opts() -> TargetOptions {
|
||||
let pre_link_args_msvc = vec![
|
||||
|
@ -27,6 +27,10 @@ pub fn opts() -> TargetOptions {
|
|||
abi_return_struct_as_int: true,
|
||||
emit_debug_gdb_scripts: false,
|
||||
|
||||
// Currently this is the only supported method of debuginfo on MSVC
|
||||
// where `*.pdb` files show up next to the final artifact.
|
||||
split_debuginfo: SplitDebuginfo::Packed,
|
||||
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue