[PATCH] D137723: [PDB] Don't include input files in the 'cmd' entry of S_ENVBLOCK
Sylvain Audi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 10 12:44:08 PST 2022
saudi updated this revision to Diff 474593.
saudi added a comment.
Perform the argument list filtering in the driver, to use the result of parsed arguments.
Updated `pdb-linker-module.test`, checking that the object file is indeed discarded.
Since the object file is provided as an absolute path, this checks that '/path/to/file.o' is not mistaken for a command line argument.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137723/new/
https://reviews.llvm.org/D137723
Files:
lld/COFF/DriverUtils.cpp
lld/docs/ReleaseNotes.rst
lld/test/COFF/pdb-linker-module.test
lld/test/COFF/pdb-relative-source-lines.test
Index: lld/test/COFF/pdb-relative-source-lines.test
===================================================================
--- lld/test/COFF/pdb-relative-source-lines.test
+++ lld/test/COFF/pdb-relative-source-lines.test
@@ -77,7 +77,7 @@
CHECK-NEXT: - pdb
CHECK-NEXT: - 'c:\src\out.pdb'
CHECK-NEXT: - cmd
-CHECK-NEXT: - '-debug -pdbsourcepath:c:\src -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj'
+CHECK-NEXT: - '-debug -pdbsourcepath:c:\src -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb'
CHECK-LABEL: IpiStream:
@@ -125,7 +125,7 @@
POSIX-NEXT: - pdb
POSIX-NEXT: - '/usr/src/out.pdb'
POSIX-NEXT: - cmd
-POSIX-NEXT: - '-debug -pdbsourcepath:/usr/src -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj'
+POSIX-NEXT: - '-debug -pdbsourcepath:/usr/src -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb'
ABSOLUTE-LABEL: StringTable:
ABSOLUTE-NOT: {{/|\\}}.{{/|\\}}pdb_lines_1.c
Index: lld/test/COFF/pdb-linker-module.test
===================================================================
--- lld/test/COFF/pdb-linker-module.test
+++ lld/test/COFF/pdb-linker-module.test
@@ -22,4 +22,4 @@
SYMS-NEXT: - pdb
SYMS-NEXT: - {{.*}}pdb-linker-module{{.*}}pdb
SYMS-NEXT: - cmd
-SYMS-NEXT: - /debug /pdb:{{.*}}pdb-linker-module{{.*}}pdb /nodefaultlib "/entry:1 ""hello"" 2" "/manifestuac:level='asInvoker' uiAccess='false'" {{.*}}pdb-diff.obj
+SYMS-NEXT: - /debug /pdb:{{.*}}pdb-linker-module{{.*}}pdb /nodefaultlib "/entry:1 ""hello"" 2" "/manifestuac:level='asInvoker' uiAccess='false'" /force
Index: lld/docs/ReleaseNotes.rst
===================================================================
--- lld/docs/ReleaseNotes.rst
+++ lld/docs/ReleaseNotes.rst
@@ -40,7 +40,9 @@
COFF Improvements
-----------------
-* ...
+* The linker command line entry in ``S_ENVBLOCK`` of the PDB is now stripped
+ from input files, to align with MSVC behavior.
+ (`D137723 <https://reviews.llvm.org/D137723>`_)
MinGW Improvements
------------------
Index: lld/COFF/DriverUtils.cpp
===================================================================
--- lld/COFF/DriverUtils.cpp
+++ lld/COFF/DriverUtils.cpp
@@ -855,8 +855,13 @@
}
// Save the command line after response file expansion so we can write it to
- // the PDB if necessary.
- config->argv = {expandedArgv.begin(), expandedArgv.end()};
+ // the PDB if necessary. Mimic MSVC, which skips input files.
+ config->argv = {argv.data(), argv.data() + 1};
+ for (opt::Arg *arg : args) {
+ if (arg->getOption().getKind() != opt::Option::InputClass) {
+ config->argv.push_back(args.getArgString(arg->getIndex()));
+ }
+ }
// Handle /WX early since it converts missing argument warnings to errors.
errorHandler().fatalWarnings = args.hasFlag(OPT_WX, OPT_WX_no, false);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137723.474593.patch
Type: text/x-patch
Size: 2945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221110/56b4952a/attachment.bin>
More information about the llvm-commits
mailing list