[PATCH] Fix mach-o tests on Windows
Rui Ueyama
ruiu at google.com
Wed Aug 6 12:46:38 PDT 2014
Closed by commit rL214990 (authored by @ruiu).
REPOSITORY
rL LLVM
http://reviews.llvm.org/D4710
Files:
lld/trunk/lib/Driver/DarwinLdDriver.cpp
lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
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 <algorithm>
+
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);
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 <algorithm>
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4710.12247.patch
Type: text/x-patch
Size: 2173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140806/67064f06/attachment.bin>
More information about the llvm-commits
mailing list