in src/compiler/c.rs [311:354]
fn parse_arguments(
&self,
arguments: &[OsString],
cwd: &Path,
env_vars: &[(OsString, OsString)],
) -> CompilerArguments<Box<dyn CompilerHasher<T> + 'static>> {
match self.compiler.parse_arguments(arguments, cwd, env_vars) {
CompilerArguments::Ok(mut args) => {
// Handle SCCACHE_EXTRAFILES
for (k, v) in env_vars.iter() {
if k.as_os_str() == OsStr::new("SCCACHE_EXTRAFILES") {
args.extra_hash_files.extend(std::env::split_paths(&v))
}
}
// Handle cache invalidation for the ROCm device bitcode libraries. Every HIP
// object links in some LLVM bitcode libraries (.bc files), so in some sense
// every HIP object compilation has an direct dependency on those bitcode
// libraries.
//
// The bitcode libraries are unlikely to change **except** when a ROCm version
// changes, so for correctness we should take these bitcode libraries into
// account by adding them to `extra_hash_files`.
//
// In reality, not every available bitcode library is needed, but that is
// too much to handle on our side so we just hash every bitcode library we find.
if args.language == Language::Hip {
args.extra_hash_files
.extend(Self::search_hip_device_libs(&args, env_vars))
}
CompilerArguments::Ok(Box::new(CCompilerHasher {
parsed_args: args,
executable: self.executable.clone(),
executable_digest: self.executable_digest.clone(),
compiler: self.compiler.clone(),
}))
}
CompilerArguments::CannotCache(why, extra_info) => {
CompilerArguments::CannotCache(why, extra_info)
}
CompilerArguments::NotCompilation => CompilerArguments::NotCompilation,
}
}