Index: lld/trunk/lib/Driver/DarwinLdDriver.cpp =================================================================== --- lld/trunk/lib/Driver/DarwinLdDriver.cpp +++ lld/trunk/lib/Driver/DarwinLdDriver.cpp @@ -32,6 +32,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Signals.h" +#include namespace { @@ -361,7 +362,11 @@ diagnostics << "Unable to find library -l" << arg->getValue() << "\n"; return false; } else if (ctx.testingLibResolution()) { - diagnostics << "Found library " << resolvedPath.get() << '\n'; + // Test may be running on Windows. Canonicalize the path + // separator to '/' to get consistent outputs for tests. + std::string path = resolvedPath.get(); + std::replace(path.begin(), path.end(), '\\', '/'); + diagnostics << "Found library " << path << '\n'; } inputPath = resolvedPath.get(); break; Index: lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp =================================================================== --- lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp +++ lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp @@ -25,6 +25,8 @@ #include "llvm/Support/MachO.h" #include "llvm/Support/Path.h" +#include + using lld::mach_o::ArchHandler; using namespace llvm::MachO; @@ -297,7 +299,9 @@ // Otherwise, we're in test mode: only files explicitly provided on the // command-line exist. - return _existingPaths.find(path) != _existingPaths.end(); + std::string key = path.str(); + std::replace(key.begin(), key.end(), '\\', '/'); + return _existingPaths.find(key) != _existingPaths.end(); } void MachOLinkingContext::addModifiedSearchDir( @@ -308,7 +312,7 @@ // + If the last -syslibroot is "/", all of them are ignored (don't ask). // + -syslibroot only applies to absolute paths. if (!syslibRoots.empty() && syslibRoots.back() != "/" && - llvm::sys::path::is_absolute(libPath)) { + libPath.startswith("/")) { for (auto syslibRoot : syslibRoots) { SmallString<256> path(syslibRoot); llvm::sys::path::append(path, libPath);