Index: lib/Object/Archive.cpp =================================================================== --- lib/Object/Archive.cpp +++ lib/Object/Archive.cpp @@ -146,9 +146,14 @@ ErrorOr Name = getName(); if (std::error_code EC = Name.getError()) return EC; - SmallString<128> FullName = sys::path::parent_path( - Parent->getMemoryBufferRef().getBufferIdentifier()); - sys::path::append(FullName, *Name); + SmallString<128> FullName; + if (sys::path::is_absolute(*Name)) + FullName = *Name; + else { + FullName = sys::path::parent_path( + Parent->getMemoryBufferRef().getBufferIdentifier()); + sys::path::append(FullName, *Name); + } ErrorOr> Buf = MemoryBuffer::getFile(FullName); if (std::error_code EC = Buf.getError()) return EC; Index: test/Object/archive-thin-read.test =================================================================== --- /dev/null +++ test/Object/archive-thin-read.test @@ -0,0 +1,5 @@ +RUN: echo hello > %t.file +RUN: llvm-ar rcsT %t.a %t.file +RUN: llvm-ar p %t.a | FileCheck %s + +CHECK: hello