Merge "Always generate PDB for Windows executable" into main

This commit is contained in:
Treehugger Robot
2024-08-14 21:26:48 +00:00
committed by Gerrit Code Review
2 changed files with 15 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ import (
"fmt" "fmt"
"path/filepath" "path/filepath"
"runtime" "runtime"
"slices"
"strconv" "strconv"
"strings" "strings"
@@ -910,6 +911,16 @@ func transformObjToDynamicBinary(ctx android.ModuleContext,
"ldFlags": flags.globalLdFlags + " " + flags.localLdFlags, "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags,
"crtEnd": strings.Join(crtEnd.Strings(), " "), "crtEnd": strings.Join(crtEnd.Strings(), " "),
} }
// On Windows, we always generate a PDB file
// --strip-debug is needed to also keep COFF symbols which are needed when
// we patch binaries with symbol_inject.
if ctx.Windows() {
pdb := outputFile.ReplaceExtension(ctx, "pdb")
args["ldFlags"] = args["ldFlags"] + " -Wl,--strip-debug -Wl,--pdb=" + pdb.String() + " "
implicitOutputs = append(slices.Clone(implicitOutputs), pdb)
}
if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_CXX_LINKS") { if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_CXX_LINKS") {
rule = ldRE rule = ldRE
args["implicitOutputs"] = strings.Join(implicitOutputs.Strings(), ",") args["implicitOutputs"] = strings.Join(implicitOutputs.Strings(), ",")

View File

@@ -43,6 +43,10 @@ var (
"-mno-ms-bitfields", "-mno-ms-bitfields",
"--sysroot ${WindowsGccRoot}/${WindowsGccTriple}", "--sysroot ${WindowsGccRoot}/${WindowsGccTriple}",
// Windows flags to generate PDB
"-g",
"-gcodeview",
} }
windowsIncludeFlags = []string{ windowsIncludeFlags = []string{