Index: lld/trunk/ELF/InputFiles.cpp =================================================================== --- lld/trunk/ELF/InputFiles.cpp +++ lld/trunk/ELF/InputFiles.cpp @@ -86,12 +86,14 @@ // Use fake address calcuated by adding section file offset and offset in // section. See comments for ObjectInfo class. DILineInfo Info; - DILineInfoSpecifier Spec; - Tbl->getFileLineInfoForAddress(S->Offset + Offset, nullptr, Spec.FLIKind, - Info); + Tbl->getFileLineInfoForAddress( + S->Offset + Offset, nullptr, + DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, Info); if (Info.Line == 0) return ""; - return Info.FileName + ":" + std::to_string(Info.Line); + std::string Ret = Info.FileName + ":" + std::to_string(Info.Line); + convertToUnixPathSeparator({(char*)Ret.data(), Ret.size()}); + return Ret; } // Returns "(internal)", "foo.a(bar.o)" or "baz.o". Index: lld/trunk/include/lld/Core/Reproduce.h =================================================================== --- lld/trunk/include/lld/Core/Reproduce.h +++ lld/trunk/include/lld/Core/Reproduce.h @@ -11,6 +11,7 @@ #define LLD_CORE_REPRODUCE_H #include "lld/Core/LLVM.h" +#include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" #include "llvm/Support/Error.h" @@ -65,6 +66,9 @@ // Returns the string form of the given argument. std::string stringize(llvm::opt::Arg *Arg); +// Converts path to use unix path separators. +void convertToUnixPathSeparator(llvm::MutableArrayRef Path); + } #endif Index: lld/trunk/lib/Core/Reproduce.cpp =================================================================== --- lld/trunk/lib/Core/Reproduce.cpp +++ lld/trunk/lib/Core/Reproduce.cpp @@ -50,14 +50,6 @@ OS << Data; // c_filedata } -// Converts path to use unix path separators so the cpio can be extracted on -// both unix and windows. -static void convertToUnixPathSeparator(SmallString<128> &Path) { -#ifdef LLVM_ON_WIN32 - std::replace(Path.begin(), Path.end(), '\\', '/'); -#endif -} - void CpioFile::append(StringRef Path, StringRef Data) { if (!Seen.insert(Path).second) return; @@ -127,3 +119,9 @@ return K + V; return K + " " + V; } + +void lld::convertToUnixPathSeparator(MutableArrayRef Path) { +#ifdef LLVM_ON_WIN32 + std::replace(Path.begin(), Path.end(), '\\', '/'); +#endif +} Index: lld/trunk/test/ELF/Inputs/undef-debug.s =================================================================== --- lld/trunk/test/ELF/Inputs/undef-debug.s +++ lld/trunk/test/ELF/Inputs/undef-debug.s @@ -1,4 +1,4 @@ -.file 1 "undef-debug.s" +.file 1 "dir/undef-debug.s" .loc 1 3 .quad zed3 Index: lld/trunk/test/ELF/undef.s =================================================================== --- lld/trunk/test/ELF/undef.s +++ lld/trunk/test/ELF/undef.s @@ -9,9 +9,9 @@ # CHECK: error: undef.s:(.text+0x6): undefined symbol 'bar' # CHECK: error: undef.s:(.text+0x10): undefined symbol 'foo(int)' # CHECK: error: {{.*}}2.a({{.*}}.o):(.text+0x0): undefined symbol 'zed2' -# CHECK: error: undef-debug.s:3: undefined symbol 'zed3' -# CHECK: error: undef-debug.s:7: undefined symbol 'zed4' -# CHECK: error: undef-debug.s:11: undefined symbol 'zed5' +# CHECK: error: dir/undef-debug.s:3: undefined symbol 'zed3' +# CHECK: error: dir/undef-debug.s:7: undefined symbol 'zed4' +# CHECK: error: dir/undef-debug.s:11: undefined symbol 'zed5' # RUN: not ld.lld %t.o %t2.a -o %t.exe -no-demangle 2>&1 | \ # RUN: FileCheck -check-prefix=NO-DEMANGLE %s