Fix absolute paths in clang debug output
As of the latest clang python wrapper, clang is being executed with an
absolute path. That means that clang-provided headers are written with
absolute paths in the debug info, making the builds non-reproducible
(especially with ccache).
So keep our current PWD=/proc/self/pwd -fdebug-prefix-map=/proc/self/cwd=,
but add a new -fdebug-prefix-map=$PWD/= to rewrite these absolute paths.
Bug: 36463318
Test: m -j libc adb; grep for path names
Test: spot check objdump -W before/after, see only expected diffs.
Change-Id: Ic2cdfca051d3c38b753fd5c1fcbeaca8bafc29ae
diff --git a/cc/config/clang.go b/cc/config/clang.go
index 10f4cea..30ab1c6 100644
--- a/cc/config/clang.go
+++ b/cc/config/clang.go
@@ -91,6 +91,10 @@
// http://b/29823425 Disable -Wexpansion-to-defined for Clang update to r271374
"-Wno-expansion-to-defined",
+
+ // http://b/36463318 Clang executes with an absolute path, so clang-provided
+ // headers are now absolute.
+ "-fdebug-prefix-map=$$PWD/=",
}, " "))
pctx.StaticVariable("ClangExtraCppflags", strings.Join([]string{