[lld] r307423 - Use windows path syntax when writing PDB module name.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 7 11:46:15 PDT 2017


Author: zturner
Date: Fri Jul  7 11:46:14 2017
New Revision: 307423

URL: http://llvm.org/viewvc/llvm-project?rev=307423&view=rev
Log:
Use windows path syntax when writing PDB module name.

Without this we would just append whatever the user
wrote on the command line, so if we're in C:\foo
and we run lld-link bar/baz.obj, we would write
C:\foo\bar/baz.obj in various places in the PDB.
MSVC linker does not do this, so we shouldn't either.
This fixes some differences in the diff test, so we
update the test as well.

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

Modified:
    lld/trunk/COFF/PDB.cpp
    lld/trunk/test/COFF/pdb-diff.test

Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=307423&r1=307422&r2=307423&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Fri Jul  7 11:46:14 2017
@@ -315,7 +315,9 @@ static void addObjectsToPDB(BumpPtrAlloc
     bool InArchive = !File->ParentName.empty();
     SmallString<128> Path = InArchive ? File->ParentName : File->getName();
     sys::fs::make_absolute(Path);
+    sys::path::native(Path, llvm::sys::path::Style::windows);
     StringRef Name = InArchive ? File->getName() : StringRef(Path);
+
     File->ModuleDBI = &ExitOnErr(Builder.getDbiBuilder().addModuleInfo(Name));
     File->ModuleDBI->setObjFileName(Path);
 
@@ -414,7 +416,7 @@ void coff::createPDB(StringRef Path, Sym
 
   llvm::SmallString<128> NativePath(Path.begin(), Path.end());
   llvm::sys::fs::make_absolute(NativePath);
-  llvm::sys::path::native(NativePath);
+  llvm::sys::path::native(NativePath, llvm::sys::path::Style::windows);
 
   pdb::PDB_UniqueId uuid{};
   if (DI)

Modified: lld/trunk/test/COFF/pdb-diff.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb-diff.test?rev=307423&r1=307422&r2=307423&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb-diff.test (original)
+++ lld/trunk/test/COFF/pdb-diff.test Fri Jul  7 11:46:14 2017
@@ -45,7 +45,7 @@ CHECK-NEXT:   |     Named Stream "/LinkI
 CHECK-NEXT:   |------------------------------+---|
 CHECK-NEXT:   | Named Stream "/src/heade..." | D |
 CHECK-NEXT:   |------------------------------+---|
-CHECK-NEXT:   | Module "{{.*}}pdb-diff.obj" | D |
+CHECK-NEXT:   | Module "{{.*}}\pdb-diff.obj" | {{[EI]}} |
 CHECK-NEXT:   |------------------------------+---|
 CHECK-NEXT:   |          Module "* Linker *" | {{[EI]}} |
 CHECK-NEXT:   |------------------------------+---|
@@ -59,8 +59,6 @@ CHECK-NEXT:   |           Public Symbol
 CHECK-NEXT:   |------------------------------+---|
 CHECK-NEXT:   |        Public Symbol Records | D |
 CHECK-NEXT:   |------------------------------+---|
-CHECK-NEXT:   | Module "{{.*}}pdb-diff.obj" | D |
-CHECK-NEXT:   |------------------------------+---|
 CHECK-NEXT:   |                 New FPO Data | D |
 CHECK-NEXT:   |------------------------------+---|
 CHECK-NEXT:   ------------------------------------
@@ -174,9 +172,25 @@ CHECK-NEXT:   |
 CHECK-NEXT:   |----------------------------------------+---|
 CHECK-NEXT:   |                      Source File Count | I |
 CHECK-NEXT:   |----------------------------------------+---|
-CHECK-NEXT:   |Module "{{.*}}Inputs/pdb-diff.obj"|
+CHECK-NEXT:   |Module "{{.*}}\pdb-diff.obj"|
+CHECK-NEXT:   |----------------------------------------+---|
+CHECK-NEXT:   |                                 - Modi | I |
+CHECK-NEXT:   |----------------------------------------+---|
+CHECK-NEXT:   |                        - Obj File Name | {{[EI]}} |
+CHECK-NEXT:   |----------------------------------------+---|
+CHECK-NEXT:   |                         - Debug Stream | {{[EI]}} |
+CHECK-NEXT:   |----------------------------------------+---|
+CHECK-NEXT:   |                        - C11 Byte Size | I |
 CHECK-NEXT:   |----------------------------------------+---|
-CHECK-NEXT:   |                                 - Modi | D |
+CHECK-NEXT:   |                        - C13 Byte Size | I |
+CHECK-NEXT:   |----------------------------------------+---|
+CHECK-NEXT:   |                           - # of files | I |
+CHECK-NEXT:   |----------------------------------------+---|
+CHECK-NEXT:   |                  - Pdb File Path Index | I |
+CHECK-NEXT:   |----------------------------------------+---|
+CHECK-NEXT:   |               - Source File Name Index | I |
+CHECK-NEXT:   |----------------------------------------+---|
+CHECK-NEXT:   |                     - Symbol Byte Size | D |
 CHECK-NEXT:   |----------------------------------------+---|
 CHECK-NEXT:   |            Module "* Linker *"             |
 CHECK-NEXT:   |----------------------------------------+---|
@@ -198,3 +212,5 @@ CHECK-NEXT:   |               - Source F
 CHECK-NEXT:   |----------------------------------------+---|
 CHECK-NEXT:   |                     - Symbol Byte Size | D |
 CHECK-NEXT:   |----------------------------------------+---|
+
+




More information about the llvm-commits mailing list