[llvm] r273373 - llvm-ar: be more clever about default format
Mike Aizatsky via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 22 08:27:25 PDT 2016
Saleem,
This breaks the build:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/13963
[5/5] Running the LLVM regression tests
-- Testing: 17077 tests, 32 threads --
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70..
FAIL: LLVM :: Object/mri1.test (13336 of 17077)
******************** TEST 'LLVM :: Object/mri1.test' FAILED ********************
Script:
--
echo create /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/test/Object/Output/mri1.test.tmp.a
> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/test/Object/Output/mri1.test.tmp.mri
echo save >> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/test/Object/Output/mri1.test.tmp.mri
echo end >> /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/test/Object/Output/mri1.test.tmp.mri
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/./bin/llvm-ar
-M < /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/test/Object/Output/mri1.test.tmp.mri
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/./bin/llvm-ar
t /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/test/Object/Output/mri1.test.tmp.a
--
Exit Code: 77
Command Output (stderr):
--
==21929==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0xb694ba in llvm::writeArchive(llvm::StringRef,
std::__1::vector<llvm::NewArchiveIterator,
std::__1::allocator<llvm::NewArchiveIterator> >&, bool,
llvm::object::Archive::Kind, bool, bool,
std::__1::unique_ptr<llvm::MemoryBuffer,
std::__1::default_delete<llvm::MemoryBuffer> >)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/lib/Object/ArchiveWriter.cpp:376:7
#1 0x4dce49 in performWriteOperation(ArchiveOperation,
llvm::object::Archive*, std::__1::unique_ptr<llvm::MemoryBuffer,
std::__1::default_delete<llvm::MemoryBuffer> >,
std::__1::vector<llvm::NewArchiveIterator,
std::__1::allocator<llvm::NewArchiveIterator> >*)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-ar/llvm-ar.cpp:670:7
#2 0x4d6745 in performOperation(ArchiveOperation,
llvm::object::Archive*, std::__1::unique_ptr<llvm::MemoryBuffer,
std::__1::default_delete<llvm::MemoryBuffer> >,
std::__1::vector<llvm::NewArchiveIterator,
std::__1::allocator<llvm::NewArchiveIterator> >*)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-ar/llvm-ar.cpp:703:5
#3 0x4d2ecc in performOperation(ArchiveOperation,
std::__1::vector<llvm::NewArchiveIterator,
std::__1::allocator<llvm::NewArchiveIterator> >*)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-ar/llvm-ar.cpp:726:5
#4 0x4cc912 in runMRIScript
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-ar/llvm-ar.cpp:813:5
#5 0x4cc912 in parseCommandLine
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-ar/llvm-ar.cpp:197
#6 0x4cc912 in ar_main
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-ar/llvm-ar.cpp:820
#7 0x4cc912 in main
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/llvm-ar/llvm-ar.cpp:857
#8 0x7f7bb7db0f44 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
#9 0x44ab5b in _start
(/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llvm-ar+0x44ab5b)
On Wed, Jun 22, 2016 at 6:45 AM Rafael EspĂndola <
llvm-commits at lists.llvm.org> wrote:
> testcase? :-)
>
> On 22 June 2016 at 00:03, Saleem Abdulrasool via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > Author: compnerd
> > Date: Tue Jun 21 23:03:28 2016
> > New Revision: 273373
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=273373&view=rev
> > Log:
> > llvm-ar: be more clever about default format
> >
> > Try to be more clever about selecting the default format. When an
> existing
> > archive is used, use the type of the archive to determine the format.
> When
> > existing members are present, use the first member's format to determine
> the
> > format to use. If we are creating an empty archive (MRI mode) or are
> adding
> > non-object members, default to the current behaviour of using the host
> type due
> > to the lack of a better alternative. This aids in cross-compilation on
> Darwin
> > to non-Darwin platforms which rely on GNU format archives.
> >
> > Modified:
> > llvm/trunk/tools/llvm-ar/llvm-ar.cpp
> >
> > Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=273373&r1=273372&r2=273373&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
> > +++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Tue Jun 21 23:03:28 2016
> > @@ -19,6 +19,7 @@
> > #include "llvm/LibDriver/LibDriver.h"
> > #include "llvm/Object/Archive.h"
> > #include "llvm/Object/ArchiveWriter.h"
> > +#include "llvm/Object/MachO.h"
> > #include "llvm/Object/ObjectFile.h"
> > #include "llvm/Support/CommandLine.h"
> > #include "llvm/Support/Errc.h"
> > @@ -575,21 +576,86 @@ computeNewArchiveMembers(ArchiveOperatio
> > return Ret;
> > }
> >
> > +static object::Archive::Kind getDefaultForHost() {
> > + return Triple(sys::getProcessTriple()).isOSDarwin() ?
> object::Archive::K_BSD
> > + :
> object::Archive::K_GNU;
> > +}
> > +
> > +static object::Archive::Kind
> > +getKindFromMember(const NewArchiveIterator &Member) {
> > + if (Member.isNewMember()) {
> > + object::Archive::Kind Kind = getDefaultForHost();
> > +
> > + sys::fs::file_status Status;
> > + if (auto OptionalFD = Member.getFD(Status)) {
> > + auto OptionalMB = MemoryBuffer::getOpenFile(*OptionalFD,
> Member.getName(),
> > + Status.getSize(),
> false);
> > + if (OptionalMB) {
> > + MemoryBufferRef MemoryBuffer = (*OptionalMB)->getMemBufferRef();
> > +
> > + Expected<std::unique_ptr<object::ObjectFile>> OptionalObject =
> > + object::ObjectFile::createObjectFile(MemoryBuffer);
> > +
> > + if (OptionalObject)
> > + Kind = isa<object::MachOObjectFile>(**OptionalObject)
> > + ? object::Archive::K_BSD
> > + : object::Archive::K_GNU;
> > +
> > + // squelch the error in case we had a non-object file
> > + consumeError(OptionalObject.takeError());
> > + }
> > +
> > + if (close(*OptionalFD) != 0)
> > + failIfError(std::error_code(errno, std::generic_category()),
> > + "failed to close file");
> > + }
> > +
> > + return Kind;
> > + } else {
> > + const object::Archive::Child &OldMember = Member.getOld();
> > + if (OldMember.getParent()->isThin())
> > + return object::Archive::Kind::K_GNU;
> > +
> > + auto OptionalMB = OldMember.getMemoryBufferRef();
> > + failIfError(OptionalMB.getError());
> > +
> > + Expected<std::unique_ptr<object::ObjectFile>> OptionalObject =
> > + object::ObjectFile::createObjectFile(*OptionalMB);
> > +
> > + if (OptionalObject)
> > + return isa<object::MachOObjectFile>(*OptionalObject->get())
> > + ? object::Archive::K_BSD
> > + : object::Archive::K_GNU;
> > +
> > + // squelch the error in case we had a non-object file
> > + consumeError(OptionalObject.takeError());
> > + return getDefaultForHost();
> > + }
> > +}
> > +
> > static void
> > performWriteOperation(ArchiveOperation Operation,
> > object::Archive *OldArchive,
> > std::unique_ptr<MemoryBuffer> OldArchiveBuf,
> > std::vector<NewArchiveIterator> *NewMembersP) {
> > + std::vector<NewArchiveIterator> NewMembers;
> > + if (!NewMembersP)
> > + NewMembers = computeNewArchiveMembers(Operation, OldArchive);
> > +
> > object::Archive::Kind Kind;
> > switch (FormatOpt) {
> > - case Default: {
> > - Triple T(sys::getProcessTriple());
> > - if (T.isOSDarwin() && !Thin)
> > - Kind = object::Archive::K_BSD;
> > - else
> > + case Default:
> > + if (Thin)
> > Kind = object::Archive::K_GNU;
> > + else if (OldArchive)
> > + Kind = OldArchive->kind();
> > + else if (NewMembersP)
> > + Kind = NewMembersP->size() ?
> getKindFromMember(NewMembersP->front())
> > + : getDefaultForHost();
> > + else
> > + Kind = NewMembers.size() ? getKindFromMember(NewMembers.front())
> > + : getDefaultForHost();
> > break;
> > - }
> > case GNU:
> > Kind = object::Archive::K_GNU;
> > break;
> > @@ -599,18 +665,10 @@ performWriteOperation(ArchiveOperation O
> > Kind = object::Archive::K_BSD;
> > break;
> > }
> > - if (NewMembersP) {
> > - std::pair<StringRef, std::error_code> Result = writeArchive(
> > - ArchiveName, *NewMembersP, Symtab, Kind, Deterministic, Thin,
> > - std::move(OldArchiveBuf));
> > - failIfError(Result.second, Result.first);
> > - return;
> > - }
> > - std::vector<NewArchiveIterator> NewMembers =
> > - computeNewArchiveMembers(Operation, OldArchive);
> > - auto Result =
> > - writeArchive(ArchiveName, NewMembers, Symtab, Kind,
> Deterministic, Thin,
> > - std::move(OldArchiveBuf));
> > +
> > + std::pair<StringRef, std::error_code> Result =
> > + writeArchive(ArchiveName, NewMembersP ? *NewMembersP :
> NewMembers, Symtab,
> > + Kind, Deterministic, Thin, std::move(OldArchiveBuf));
> > failIfError(Result.second, Result.first);
> > }
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
--
Mike
Sent from phone
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160622/d70e2d7a/attachment.html>
More information about the llvm-commits
mailing list