Revert "win: Pass /pdbaltpath:%_PDB% to the linker every time we pass /DEBUG."
This reverts commit 40fd334b2612873423051c30d6d2dd91d6081d34.
Reason for revert: It breaks the "official symbols" upload step, see
crbug.com/894991
Original change's description:
> win: Pass /pdbaltpath:%_PDB% to the linker every time we pass /DEBUG.
>
> The linker by defaults writes the absolute path to the corresponding pdb
> into executables it creates (if /DEBUG is passed).
>
> /pdbaltpath:%_PDB% tells it to instead just write the basename of the pdb
> into the executable, which makes the build more reproducible:
>
> 1. Different build directories no longer cause the part of the exe that contains
> the pdb path to be different.
>
> 2. More subtly, the pdb file contains offsets into the executable, and if the
> pdb path has different lengths on different systems, the pdb file will be
> different due to the absolute pdb path in the executable. lld-link sets the
> UUID of the pdb to the hash of the pdb file contents, and the UUID of the
> pdb is also stored in the executable. So this is also one of the parts
> needed to make the pdb output deterministic.
>
> (Note that while link.exe has supported /pdbaltpath:%_PDB% for a long time,
> lld-link learned about %_PDB% only very recently, and this CL depends on the
> clang roll https://chromium-review.googlesource.com/c/1271718.)
>
> Bug: 330260
> Change-Id: If4c505ababa46ed4f51330521ff09f12f6840a47
> Reviewed-on: https://chromium-review.googlesource.com/c/1273475
> Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
> Commit-Queue: Nico Weber <thakis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#598940}
TBR=thakis@chromium.org,brucedawson@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: 330260
Change-Id: Iecb3de9f19f9d4e3932784ba9e68b00001bb8986
Reviewed-on: https://chromium-review.googlesource.com/c/1279225
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Sébastien Marchand <sebmarchand@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599398}
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 148e913..0f7a6b4 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -2182,22 +2182,6 @@
# configs -= [ "//build/config/compiler:default_symbols" ]
# configs += [ "//build/config/compiler:symbols" ]
-# A helper config that all configs passing /DEBUG to the linker should
-# include as sub-config.
-config("win_pdbaltpath") {
- visibility = [
- ":symbols",
- ":minimal_symbols",
- ]
-
- # /DEBUG causes the linker to generate a pdb file, and to write the absolute
- # path to it in the executable file it generates. This flag turns that
- # absolute path into just the basename of the pdb file, which helps with
- # build reproducibility. Debuggers look for pdb files next to executables,
- # so there's no downside to always using this.
- ldflags = [ "/pdbaltpath:%_PDB%" ]
-}
-
# Full symbols.
config("symbols") {
if (is_win) {
@@ -2228,9 +2212,6 @@
ldflags = [ "/DEBUG" ]
}
- # All configs using /DEBUG should include this:
- configs = [ ":win_pdbaltpath" ]
-
if (is_clang) {
# /DEBUG:FASTLINK requires every object file to have standalone debug
# information.
@@ -2306,9 +2287,6 @@
cflags = []
ldflags = [ "/DEBUG" ]
- # All configs using /DEBUG should include this:
- configs = [ ":win_pdbaltpath" ]
-
# For win/asan, get stack traces with full line numbers.
# AddressSanitizerTests.TestAddressSanitizer needs this, and since
# win/asan isn't a default cq bot the build time hit is ok.
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index db14f673..3a41fb56 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -139,7 +139,7 @@
if (!is_debug && !is_component_build) {
# Enable standard linker optimizations like GC (/OPT:REF) and ICF in static
# release builds. These are implied by /PROFILE below, but /PROFILE is
- # incompatible with /debug:fastlink.
+ # incompatible with /debug:fastlink and LLD ignores it as of this writing.
# Release builds always want these optimizations, so enable them explicitly.
# TODO(crbug.com/884545): Remove the checks for use_libfuzzer when
# libFuzzer's issues with /OPT:REF are resolved upstream.