[lld] 7f0664f - [LLD][COFF] Clean paths in PDB even when /pdbsourcepath is omitted

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 31 16:06:01 PDT 2021


Author: Alexandre Ganea
Date: 2021-08-31T19:05:10-04:00
New Revision: 7f0664f1936a75ce939e4b3f3d6e72da5fcc6a60

URL: https://github.com/llvm/llvm-project/commit/7f0664f1936a75ce939e4b3f3d6e72da5fcc6a60
DIFF: https://github.com/llvm/llvm-project/commit/7f0664f1936a75ce939e4b3f3d6e72da5fcc6a60.diff

LOG: [LLD][COFF] Clean paths in PDB even when /pdbsourcepath is omitted

Differential Revision: https://reviews.llvm.org/D109030

Added: 
    

Modified: 
    lld/COFF/PDB.cpp
    lld/test/COFF/pdb-relative-source-lines.test

Removed: 
    


################################################################################
diff  --git a/lld/COFF/PDB.cpp b/lld/COFF/PDB.cpp
index e355857dd93d7..189bf6038c7d3 100644
--- a/lld/COFF/PDB.cpp
+++ b/lld/COFF/PDB.cpp
@@ -266,6 +266,7 @@ static void pdbMakeAbsolute(SmallVectorImpl<char> &fileName) {
   if (config->pdbSourcePath.empty()) {
     sys::path::native(fileName);
     sys::fs::make_absolute(fileName);
+    sys::path::remove_dots(fileName, true);
     return;
   }
 

diff  --git a/lld/test/COFF/pdb-relative-source-lines.test b/lld/test/COFF/pdb-relative-source-lines.test
index 547056785962a..cc241c7ee4d7c 100644
--- a/lld/test/COFF/pdb-relative-source-lines.test
+++ b/lld/test/COFF/pdb-relative-source-lines.test
@@ -37,6 +37,10 @@ RUN: llvm-pdbutil pdb2yaml -modules -module-files -module-syms -subsections=line
 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:         - 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'
+
+ABSOLUTE-LABEL: StringTable:
+ABSOLUTE-NOT: {{/|\\}}.{{/|\\}}pdb_lines_1.c


        


More information about the llvm-commits mailing list