• Home
  • Raw
  • Download

Lines Matching +full:compiler +full:- +full:cache

1 # -*- coding: utf-8 -*-
3 # Use of this source code is governed by a BSD-style license that can be
6 # This script is used to help the compiler wrapper in the ChromeOS and
12 two sets (good and bad) of object files. Mostly used to find compiler
16 …m/a/google.com/chromeos-toolchain-team-home2/home/team-tools-and-scripts/bisecting-chromeos-compil…
19 https://docs.google.com/document/d/1yDgaUIa2O5w6dc3sSTe1ry-1ehKajTGJGQCbyn0fcEM
45 """The general compiler wrapper error class."""
91 Log current working directory, current execargs, and a from-to relationship
97 log.write("%s -> %s\n" % (link_from, link_to))
110 """Determine which cache an object belongs to.
136 Absolute object path from execution args (-o argument). If no object being
137 outputted, then return empty string. -o argument is checked only if -c is
141 i = execargs.index("-o")
142 _ = execargs.index("-c")
149 "-",
160 or obj_path.find("CMakeTmp") != -1
161 or os.path.abspath(obj_path).find("CMakeTmp") != -1
172 Absolute path of dependency file path from execution args (-o argument). If
175 if "-MD" not in execargs and "-MMD" not in execargs:
178 # If -MF is given this is the path of the dependency file. Otherwise the
179 # dependency file is the value of -o but with a .d extension
180 if "-MF" in execargs:
181 i = execargs.index("-MF")
189 return full_obj_path[:-2] + ".d"
196 Absolute dwo file path from execution args (-gsplit-dwarf argument) If no
199 if "-gsplit-dwarf" not in execargs:
206 return full_obj_path[:-2] + ".dwo"
223 """Determine side effects generated by compiler
226 List of paths of objects that the compiler generates as side effects.
230 # Cache dependency files
235 # Cache dwo files
243 def cache_file(execargs, bisect_dir, cache, abs_file_path): argument
244 """Cache compiler output file (.o/.d/.dwo).
247 execargs: compiler execution arguments.
249 cache: Which cache the file will be cached to (GOOD/BAD).
256 bisect_path = os.path.join(bisect_dir, cache) + abs_file_path
259 pop_log = os.path.join(bisect_dir, cache, "_POPULATE_LOG")
266 population_dir = os.path.join(bisect_dir, cache)
274 "Trying to cache file %s multiple times. To avoid the error, set "
281 # Set cache object to be read-only so later compilations can't
290 print("Could not cache file %s" % abs_file_path, file=sys.stderr)
294 def restore_file(bisect_dir, cache, abs_file_path): argument
295 """Restore file from cache (.o/.d/.dwo).
299 cache: Which cache the file will be restored from (GOOD/BAD).
303 cached_path = os.path.join(bisect_dir, cache) + abs_file_path
314 "%s is missing from %s cache! Unsure how to proceed. Make "
315 "will now crash." % (cache, cached_path)
321 """Add necessary information to the bisect cache for the given execution.
323 Extract the necessary information for bisection from the compiler
324 execution arguments and put it into the bisection cache. This
326 file path to the cache list and keeping a log of the execution.
329 execargs: compiler execution arguments.
331 population_name: name of the cache being populated (good/bad).
338 # This is not a normal compiler call because it doesn't have a -o argument,
339 # or the -o argument has an unusable output file.
340 # It's likely that this compiler call was actually made to invoke the linker,
342 # compiler and return.
346 # Return if not able to cache the object file
361 """Use object object file from appropriate cache (good/bad).
367 side effects of compiler.
370 execargs: compiler execution arguments.
376 # If the output isn't an object file just call compiler
380 # If this isn't a bisected object just call compiler
385 log_to_file(log_file, execargs, "? compiler", full_obj_path)
390 "%s is missing from cache! To ignore export "
396 cache = which_cache(full_obj_path)
398 # If using safe WRAPPER_SAFE_MODE option call compiler and overwrite the
399 # result from the good/bad cache. This option is safe and covers all compiler
406 restore_file(bisect_dir, cache, full_obj_path)
409 # Generate compiler side effects. Trick Make into thinking compiler was
412 restore_file(bisect_dir, cache, side_effect)
415 # over from cache again.
417 restore_file(bisect_dir, cache, full_obj_path)