Index: llvm/tools/llvm-rc/ResourceFileWriter.cpp =================================================================== --- llvm/tools/llvm-rc/ResourceFileWriter.cpp +++ llvm/tools/llvm-rc/ResourceFileWriter.cpp @@ -1514,8 +1514,16 @@ SmallString<128> Cwd; std::unique_ptr Result; - // 0. The file path is absolute and the file exists. - if (sys::path::is_absolute(File)) + // 0. The file path is absolute or has a root directory, so we shouldn't + // try to append it on top of other base directories. (An absolute path + // must have a root directory, but e.g. the path "\dir\file" on windows + // isn't considered absolute, but it does have a root directory. As long as + // sys::path::append doesn't handle appending an absolute path or a path + // starting with a root directory on top of a base, we must handle this + // case separately at the top. C++17's path::append handles that case + // properly though, so if using that to append paths below, this early + // exception case could be removed.) + if (sys::path::has_root_directory(File)) return errorOrToExpected(MemoryBuffer::getFile(File, -1, false)); // 1. The current working directory.