Skip to content

Commit 4a14637

Browse files
committed
Fix: fix sccache bug for dwo file generate
1 parent 29d17c7 commit 4a14637

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/compiler/gcc.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@ where
575575
};
576576
if split_dwarf {
577577
let dwo = output.with_extension("dwo");
578+
common_args.push(OsString::from(
579+
"-D_gsplit_dwarf_path=".to_owned() + dwo.to_str().unwrap(),
580+
));
578581
// -gsplit-dwarf doesn't guarantee .dwo file if no -g is specified
579582
outputs.insert(
580583
"dwo",
@@ -1075,6 +1078,9 @@ mod test {
10751078
CompilerArguments::Ok(args) => args,
10761079
o => panic!("Got unexpected parse result: {:?}", o),
10771080
};
1081+
let mut common_and_arch_args = common_args.clone();
1082+
common_and_arch_args.extend(common_args.to_vec());
1083+
debug!("common_and_arch_args: {:?}", common_and_arch_args);
10781084
assert_eq!(Some("foo.cpp"), input.to_str());
10791085
assert_eq!(Language::Cxx, language);
10801086
assert_map_contains!(
@@ -1095,7 +1101,10 @@ mod test {
10951101
)
10961102
);
10971103
assert!(preprocessor_args.is_empty());
1098-
assert_eq!(ovec!["-gsplit-dwarf"], common_args);
1104+
assert!(
1105+
common_args.contains(&"-gsplit-dwarf".into())
1106+
&& common_args.contains(&"-D_gsplit_dwarf_path=foo.dwo".into())
1107+
);
10991108
assert!(!msvc_show_includes);
11001109
}
11011110

0 commit comments

Comments
 (0)