Use root_out_dir for fdebug-prefix-map for better cache utilization on goma

rebase_path("//.") is resolved to the path like "$HOME/chromium/src".
But it is necessary to be like "$HOME/chromium/src/out/Release" for higher cache hit rate when using goma.

This patch allows us to share goma backend cache where we build in different out directory like
out/feature_a and out/feature_b if compile requests has only difference of cwd and -fdebug-prefix-map flag.

If we use same args.gn with linux_chromium_rel_ng, this patch allows us to use cached result generated by buildbot
even if we do not clone chromium to path like '/b/c/b/linux/src/' and 'out/Release'.

Note that some generated files having directive like `#include "out/Release/..."` is not normalized, but there is a few such tasks.

Change-Id: I1232415aeedc98dc203e9d7582839bcc1cdbefc6
Reviewed-on: https://chromium-review.googlesource.com/882712
Commit-Queue: Takuto Ikuta <tikuta@google.com>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Shinya Kawanaka <shinyak@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#531840}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 63f179b14e49adf71ba96abf59a5efc3c51aba65
This commit is contained in:
Takuto Ikuta 2018-01-25 07:30:43 +00:00 коммит произвёл Commit Bot
Родитель 3e3eeac75e
Коммит 5af4b98d30
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -483,7 +483,15 @@ config("compiler") {
# Currently disabled for nacl since its toolchain lacks this flag (too old).
# TODO(zforman): Once nacl's toolchain is updated, remove check.
if (is_clang && is_linux && strip_absolute_paths_from_debug_symbols) {
absolute_path = rebase_path("//.")
# This is resolved to path like "$HOME/chromium/src/out/Release".
# If debug option is given, clang includes $cwd in debug info.
# In such build, this flag generates reproducible obj files
# even we use build directory like "out/feature_a" and "out/feature_b" if
# we build same files with same compile flag other than this.
# Other paths are already givne in relative, no need to normalize it by
# using -fdebug-prefix-map.
absolute_path = rebase_path(root_out_dir)
cflags += [ "-fdebug-prefix-map=$absolute_path=." ]
}