[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
Fri Nov 11 07:25:23 PST 2022


saudi updated this revision to Diff 474759.
saudi added a comment.

Simplified init of `config->argv`


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[0]};
+  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.474759.patch
Type: text/x-patch
Size: 2924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221111/eb70fbbd/attachment.bin>


More information about the llvm-commits mailing list