[PATCH] D109030: [LLD][COFF] Clean paths in PDB even when /pdbsourcepath isn't used

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 31 15:28:54 PDT 2021


aganea created this revision.
aganea added reviewers: rnk, thakis.
aganea requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Some of our build system scripts & third party solutions have a hard time without this.
Before this patch we had "dotted" paths such as:

  StringTable:
          15:  - 'F:\blah\.\file.cpp'


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109030

Files:
  lld/COFF/PDB.cpp
  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
@@ -37,6 +37,10 @@
 RUN: ./lld-link -debug "-pdbsourcepath:/usr/src" -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj
 RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck --check-prefix=POSIX %s
 
+Also check without -pdbsourcepath
+RUN: ./lld-link -debug -entry:main -nodefaultlib -out:out.exe -pdb:out.pdb pdb_lines_1_relative.obj pdb_lines_2_relative.obj
+RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=lines,fc %t/out.pdb | FileCheck --check-prefix=ABSOLUTE %s
+
 CHECK-LABEL:  - Module:          'c:\src\pdb_lines_1_relative.obj'
 CHECK-NEXT:     ObjFile:         'c:\src\pdb_lines_1_relative.obj'
 CHECK:          SourceFiles:
@@ -103,3 +107,6 @@
 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'
+
+ABSOLUTE-LABEL: StringTable:
+ABSOLUTE-NOT: {{/|\\}}.{{/|\\}}pdb_lines_1.c
Index: lld/COFF/PDB.cpp
===================================================================
--- lld/COFF/PDB.cpp
+++ lld/COFF/PDB.cpp
@@ -266,6 +266,7 @@
   if (config->pdbSourcePath.empty()) {
     sys::path::native(fileName);
     sys::fs::make_absolute(fileName);
+    sys::path::remove_dots(fileName, true);
     return;
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109030.369807.patch
Type: text/x-patch
Size: 1646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210831/1f79ba09/attachment.bin>


More information about the llvm-commits mailing list