diff options
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index ddd82663eee..1939424eb8b 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -19,6 +19,7 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/StringSaver.h" +#include <cctype> using namespace llvm; using namespace lld; @@ -138,8 +139,12 @@ void LinkerScript::expect(StringRef Expect) { error(Expect + " expected, but got " + Tok); } +static bool isDOSAbsolutePath(StringRef S) { + return isalpha(S[0]) && S.substr(1).startswith(":\\"); +} + void LinkerScript::addFile(StringRef S) { - if (S.startswith("/")) { + if (S.startswith("/") || isDOSAbsolutePath(S)) { Driver->addFile(S); } else if (S.startswith("=")) { if (Config->Sysroot.empty()) |