Skip to content

[LLD] [MinGW] Respect the -S/-s options when writing PDB files #75181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lld/MinGW/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
9 changes: 8 additions & 1 deletion lld/test/MinGW/driver.test
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,18 @@ STRIP-DEBUG-NOT: -debug:dwarf
RUN: ld.lld -### -m i386pep foo.o -pdb out.pdb 2>&1 | FileCheck -check-prefix PDB %s
RUN: ld.lld -### -m i386pep foo.o -pdb=out.pdb 2>&1 | FileCheck -check-prefix PDB %s
PDB: -debug -pdb:out.pdb
PDB-NOT: -debug:dwarf
PDB-NOT: -debug:

RUN: ld.lld -### -m i386pep foo.o -pdb= 2>&1 | FileCheck -check-prefix PDB-DEFAULT %s
PDB-DEFAULT: -debug
PDB-DEFAULT-NOT: -pdb:{{.*}}
PDB-DEFAULT-NOT: -debug:

RUN: ld.lld -### -m i386pep foo.o -pdb= -S 2>&1 | FileCheck -check-prefix PDB-NODWARF %s
PDB-NODWARF: -debug -debug:nodwarf,symtab

RUN: ld.lld -### -m i386pep foo.o -pdb= -s 2>&1 | FileCheck -check-prefix PDB-NODWARF-NOSYMTAB %s
PDB-NODWARF-NOSYMTAB: -debug -debug:nodwarf,nosymtab

RUN: ld.lld -### -m i386pep foo.o --large-address-aware 2>&1 | FileCheck -check-prefix LARGE-ADDRESS-AWARE %s
LARGE-ADDRESS-AWARE: -largeaddressaware
Expand Down