aboutsummaryrefslogtreecommitdiff
path: root/lld/MinGW/Driver.cpp
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2023-12-15 20:12:03 +0200
committerGitHub <noreply@github.com>2023-12-15 20:12:03 +0200
commit7dcd8ef135147de1576c2863b963ec929a15e8cb (patch)
treedcc7851adb507db45b2d8b9cea28cd217b9affda /lld/MinGW/Driver.cpp
parente36535d4bebadfbcfea34aa369743aafc43dcf6c (diff)
downloadllvm-7dcd8ef135147de1576c2863b963ec929a15e8cb.zip
llvm-7dcd8ef135147de1576c2863b963ec929a15e8cb.tar.gz
llvm-7dcd8ef135147de1576c2863b963ec929a15e8cb.tar.bz2
[LLD] [MinGW] Respect the -S/-s options when writing PDB files (#75181)
This allows avoiding including some stray DWARF sections (e.g. from toolchain provided files), when writing a PDB file. While that probably could be considered reasonable default behaviour, PDB writing and including DWARF sections are two entirely orthogonal concepts, and GNU ld (which can generate PDB files these days) does include DWARF unless -S/-s is passed, when creating a PDB.
Diffstat (limited to 'lld/MinGW/Driver.cpp')
-rw-r--r--lld/MinGW/Driver.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lld/MinGW/Driver.cpp b/lld/MinGW/Driver.cpp
index d22b617..94f0ae7 100644
--- a/lld/MinGW/Driver.cpp
+++ b/lld/MinGW/Driver.cpp
@@ -297,6 +297,11 @@ bool link(ArrayRef<const char *> argsArr, llvm::raw_ostream &stdoutOS,
StringRef v = a->getValue();
if (!v.empty())
add("-pdb:" + v);
+ if (args.hasArg(OPT_strip_all)) {
+ add("-debug:nodwarf,nosymtab");
+ } else if (args.hasArg(OPT_strip_debug)) {
+ add("-debug:nodwarf,symtab");
+ }
} else if (args.hasArg(OPT_strip_debug)) {
add("-debug:symtab");
} else if (!args.hasArg(OPT_strip_all)) {