Open YaronStavitzky opened 1 year ago
We tried both 0.3.3 and 0.4.0 pre6 (x86_64 and aarch64).
How will this flag affect the compile result? We need to decide whether ignore or add this flag into our hash calculations.
@Xuanwo Let's assume you can't know what the plugin does - it is custom code. Some plugins can change the code being compiled and thus affect the output. So I think it is best to just add all those flags into the hash calculation as they are.
@da-x Thanks for the explaination.
So I think it is best to just add all those flags into the hash calculation as they are.
@YaronStavitzky Please take a look over https://github.com/mozilla/sccache/blob/64eeb966aab499b4661e0e805818d1941a551f21/src/compiler/clang.rs#L161 and add -fadd-orion-trace-types
as a flag.
@Xuanwo why does this array need to be modified specially for -fadd-orion-trace-type
? This flag -fadd-orion-trace-type
is actually a parameter for -plugin-arg-orion
, which is a parameter to the orion plugin that is brought by -fplugin=compilation/build/orion-plugin/orion-clang-plugin.so
.
To implement what I suggested earlier, I think the algorithm in sccache
side should be as follows:
-Xclang A
as giving parameter A
to Clang. E.g. with -Xclang A -Xclang B -Xclang C
, Clang gets a vector of parameters A B C
.A B C
, regard all -plugin-arg-X T
as plugin arguments which should be hashed as-is, so -plugin-arg-X -fadd-orion-trace-types
gets hashed. The original vector or arguments -Xclang -plugin-arg-X -Xclang -fadd-orion-trace-types
gets hashed therefore.@Xuanwo I added
take_arg!("-fadd-orion-trace-types", OsString, Separated, PassThrough),
at the end of counted_array!(pub static ARGS: [ArgInfo<gcc::ArgData>; _] = [
It did not work, should it be placed in a different position in the array?
Actually, shouldn't we also handle the -plugin-arg-orion
?
@Xuanwo we fixed it by adding Argument::UnknownFlag(_) if follows_plugin_arg => &mut common_args,
to src/compiler/clang.rs
:
None => match arg {
Argument::Raw(_) if follows_plugin_arg => &mut common_args,
Argument::Raw(_) => cannot_cache!("Can't handle Raw arguments with -Xclang"),
Argument::UnknownFlag(_) if follows_plugin_arg => &mut common_args,
Argument::UnknownFlag(flag) => {
cannot_cache!(
"Can't handle UnknownFlag arguments with -Xclang",
flag.to_str().unwrap_or("").to_string()
)
}
_ => unreachable!(),
},
we fixed it by adding
Argument::UnknownFlag(_) if follows_plugin_arg => &mut common_args,
tosrc/compiler/clang.rs
:
Would you be willing to submit a pull request for this?
We are using sccache with S3 for the past few weeks, testing if we can get some benefits. Everything was fine until our most recent release, where we added a clang plugin.
This is what we are passing to clang:
Example output from sccache log:
sccache -s
output:Is there anything that we can do on our side or do we have to implement something in sccache's code? I would be happy to provide anything to help!