Skip to content

Commit

Permalink
Fix: fix sccache bug for dwo file generate
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouronghua committed Oct 9, 2024
1 parent 29d17c7 commit dab2332
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/compiler/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,11 @@ where
// use in creating a hash key
let mut common_and_arch_args = parsed_args.common_args.clone();
common_and_arch_args.extend(parsed_args.arch_args.to_vec());
debug!(
"[{}]: common_and_arch_args: {:?}",
parsed_args.output_pretty(),
common_and_arch_args
);

let key = {
hash_key(
Expand Down
11 changes: 10 additions & 1 deletion src/compiler/gcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ where
};
if split_dwarf {
let dwo = output.with_extension("dwo");
common_args.push(OsString::from("-D_gsplit_dwarf_path=".to_owned() + dwo.to_str().unwrap()));
// -gsplit-dwarf doesn't guarantee .dwo file if no -g is specified
outputs.insert(
"dwo",
Expand Down Expand Up @@ -1075,6 +1076,12 @@ mod test {
CompilerArguments::Ok(args) => args,
o => panic!("Got unexpected parse result: {:?}", o),
};
let mut common_and_arch_args = common_args.clone();
common_and_arch_args.extend(common_args.to_vec());
debug!(
"common_and_arch_args: {:?}",
common_and_arch_args
);
assert_eq!(Some("foo.cpp"), input.to_str());
assert_eq!(Language::Cxx, language);
assert_map_contains!(
Expand All @@ -1095,7 +1102,9 @@ mod test {
)
);
assert!(preprocessor_args.is_empty());
assert_eq!(ovec!["-gsplit-dwarf"], common_args);
assert!(common_args.contains(&"-gsplit-dwarf".into())
&& common_args.contains(&"-D_gsplit_dwarf_path=foo.dwo".into())
);
assert!(!msvc_show_includes);
}

Expand Down

0 comments on commit dab2332

Please sign in to comment.