[lld] r344279 - Revert SymbolFileNativePDB plugin.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 11 11:45:44 PDT 2018


Author: zturner
Date: Thu Oct 11 11:45:44 2018
New Revision: 344279

URL: http://llvm.org/viewvc/llvm-project?rev=344279&view=rev
Log:
Revert SymbolFileNativePDB plugin.

This was originally causing some test failures on non-Windows
platforms, which required fixes in the compiler and linker.  After
those fixes, however, other tests started failing.  Reverting
temporarily until I can address everything.

Modified:
    lld/trunk/COFF/PDB.cpp

Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=344279&r1=344278&r2=344279&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Thu Oct 11 11:45:44 2018
@@ -222,22 +222,26 @@ public:
 // PDB to work without additional configuration:
 // https://docs.microsoft.com/en-us/visualstudio/debugger/debug-source-files-common-properties-solution-property-pages-dialog-box
 static void pdbMakeAbsolute(SmallVectorImpl<char> &FileName) {
-  // The default behavior is to produce paths that are valid within the context
-  // of the machine that you perform the link on.  If the linker is running on
-  // a POSIX system, we will output absolute POSIX paths.  If the linker is
-  // running on a Windows system, we will output absolute Windows paths.  If the
-  // user desires any other kind of behavior, they should explicitly pass
-  // /pdbsourcepath and/or /pdbaltpath.
-  if (sys::path::is_absolute(FileName))
+  if (sys::path::is_absolute(FileName, sys::path::Style::windows))
     return;
   if (Config->PDBSourcePath.empty()) {
+    // Debuggers generally want that PDB files contain absolute, Windows-style
+    // paths. On POSIX hosts, this here will produce an absolute POSIX-style
+    // path, which is weird -- but it's not clear what else to do.
+    // People doing cross builds should probably just always pass
+    // /pbdsourcepath: and make sure paths to input obj files and to lld-link
+    // itself are relative.
     sys::fs::make_absolute(FileName);
     return;
   }
+  // Using /pdbsourcepath: with absolute POSIX paths will prepend
+  // PDBSourcePath to the absolute POSIX path. Since absolute POSIX paths
+  // don't make sense in PDB files anyways, this is gargabe-in-garbage-out.
   SmallString<128> AbsoluteFileName = Config->PDBSourcePath;
-  sys::path::append(AbsoluteFileName, FileName);
-  sys::path::native(AbsoluteFileName);
-  sys::path::remove_dots(AbsoluteFileName, /*remove_dot_dots=*/true);
+  sys::path::append(AbsoluteFileName, sys::path::Style::windows, FileName);
+  sys::path::native(AbsoluteFileName, sys::path::Style::windows);
+  sys::path::remove_dots(AbsoluteFileName, /*remove_dot_dots=*/true,
+                         sys::path::Style::windows);
   FileName = std::move(AbsoluteFileName);
 }
 
@@ -440,7 +444,8 @@ PDBLinker::maybeMergeTypeServerPDB(ObjFi
         StringRef LocalPath =
             !File->ParentName.empty() ? File->ParentName : File->getName();
         SmallString<128> Path = sys::path::parent_path(LocalPath);
-        sys::path::append(Path, sys::path::filename(TSPath));
+        sys::path::append(
+            Path, sys::path::filename(TSPath, sys::path::Style::windows));
         return tryToLoadPDB(TSId, Path);
       },
       [&](std::unique_ptr<ECError> EC) -> Error {
@@ -1022,7 +1027,7 @@ void PDBLinker::addObjFile(ObjFile *File
   bool InArchive = !File->ParentName.empty();
   SmallString<128> Path = InArchive ? File->ParentName : File->getName();
   pdbMakeAbsolute(Path);
-  sys::path::native(Path);
+  sys::path::native(Path, sys::path::Style::windows);
   StringRef Name = InArchive ? File->getName() : StringRef(Path);
 
   pdb::DbiStreamBuilder &DbiBuilder = Builder.getDbiBuilder();
@@ -1307,7 +1312,7 @@ void PDBLinker::addSections(ArrayRef<Out
   pdb::DbiStreamBuilder &DbiBuilder = Builder.getDbiBuilder();
   NativePath = Config->PDBPath;
   pdbMakeAbsolute(NativePath);
-  sys::path::native(NativePath);
+  sys::path::native(NativePath, sys::path::Style::windows);
   uint32_t PdbFilePathNI = DbiBuilder.addECName(NativePath);
   auto &LinkerModule = ExitOnErr(DbiBuilder.addModuleInfo("* Linker *"));
   LinkerModule.setPdbFilePathNI(PdbFilePathNI);




More information about the llvm-commits mailing list