<div dir="ltr">Saleem,<div><br></div><div>This breaks the build:</div><div><br></div><div><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/13963">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/13963</a><br></div><div><br></div><div><pre style="font-family:"courier new",courier,monotype,monospace;font-size:medium;line-height:normal"><span class="inbox-inbox-stdout">[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)
</span></pre><br class="inbox-inbox-Apple-interchange-newline"></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 22, 2016 at 6:45 AM Rafael Espíndola <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">testcase? :-)<br>
<br>
On 22 June 2016 at 00:03, Saleem Abdulrasool via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
> Author: compnerd<br>
> Date: Tue Jun 21 23:03:28 2016<br>
> New Revision: 273373<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=273373&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=273373&view=rev</a><br>
> Log:<br>
> llvm-ar: be more clever about default format<br>
><br>
> Try to be more clever about selecting the default format. When an existing<br>
> archive is used, use the type of the archive to determine the format. When<br>
> existing members are present, use the first member's format to determine the<br>
> format to use. If we are creating an empty archive (MRI mode) or are adding<br>
> non-object members, default to the current behaviour of using the host type due<br>
> to the lack of a better alternative. This aids in cross-compilation on Darwin<br>
> to non-Darwin platforms which rely on GNU format archives.<br>
><br>
> Modified:<br>
> llvm/trunk/tools/llvm-ar/llvm-ar.cpp<br>
><br>
> Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=273373&r1=273372&r2=273373&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=273373&r1=273372&r2=273373&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)<br>
> +++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Tue Jun 21 23:03:28 2016<br>
> @@ -19,6 +19,7 @@<br>
> #include "llvm/LibDriver/LibDriver.h"<br>
> #include "llvm/Object/Archive.h"<br>
> #include "llvm/Object/ArchiveWriter.h"<br>
> +#include "llvm/Object/MachO.h"<br>
> #include "llvm/Object/ObjectFile.h"<br>
> #include "llvm/Support/CommandLine.h"<br>
> #include "llvm/Support/Errc.h"<br>
> @@ -575,21 +576,86 @@ computeNewArchiveMembers(ArchiveOperatio<br>
> return Ret;<br>
> }<br>
><br>
> +static object::Archive::Kind getDefaultForHost() {<br>
> + return Triple(sys::getProcessTriple()).isOSDarwin() ? object::Archive::K_BSD<br>
> + : object::Archive::K_GNU;<br>
> +}<br>
> +<br>
> +static object::Archive::Kind<br>
> +getKindFromMember(const NewArchiveIterator &Member) {<br>
> + if (Member.isNewMember()) {<br>
> + object::Archive::Kind Kind = getDefaultForHost();<br>
> +<br>
> + sys::fs::file_status Status;<br>
> + if (auto OptionalFD = Member.getFD(Status)) {<br>
> + auto OptionalMB = MemoryBuffer::getOpenFile(*OptionalFD, Member.getName(),<br>
> + Status.getSize(), false);<br>
> + if (OptionalMB) {<br>
> + MemoryBufferRef MemoryBuffer = (*OptionalMB)->getMemBufferRef();<br>
> +<br>
> + Expected<std::unique_ptr<object::ObjectFile>> OptionalObject =<br>
> + object::ObjectFile::createObjectFile(MemoryBuffer);<br>
> +<br>
> + if (OptionalObject)<br>
> + Kind = isa<object::MachOObjectFile>(**OptionalObject)<br>
> + ? object::Archive::K_BSD<br>
> + : object::Archive::K_GNU;<br>
> +<br>
> + // squelch the error in case we had a non-object file<br>
> + consumeError(OptionalObject.takeError());<br>
> + }<br>
> +<br>
> + if (close(*OptionalFD) != 0)<br>
> + failIfError(std::error_code(errno, std::generic_category()),<br>
> + "failed to close file");<br>
> + }<br>
> +<br>
> + return Kind;<br>
> + } else {<br>
> + const object::Archive::Child &OldMember = Member.getOld();<br>
> + if (OldMember.getParent()->isThin())<br>
> + return object::Archive::Kind::K_GNU;<br>
> +<br>
> + auto OptionalMB = OldMember.getMemoryBufferRef();<br>
> + failIfError(OptionalMB.getError());<br>
> +<br>
> + Expected<std::unique_ptr<object::ObjectFile>> OptionalObject =<br>
> + object::ObjectFile::createObjectFile(*OptionalMB);<br>
> +<br>
> + if (OptionalObject)<br>
> + return isa<object::MachOObjectFile>(*OptionalObject->get())<br>
> + ? object::Archive::K_BSD<br>
> + : object::Archive::K_GNU;<br>
> +<br>
> + // squelch the error in case we had a non-object file<br>
> + consumeError(OptionalObject.takeError());<br>
> + return getDefaultForHost();<br>
> + }<br>
> +}<br>
> +<br>
> static void<br>
> performWriteOperation(ArchiveOperation Operation,<br>
> object::Archive *OldArchive,<br>
> std::unique_ptr<MemoryBuffer> OldArchiveBuf,<br>
> std::vector<NewArchiveIterator> *NewMembersP) {<br>
> + std::vector<NewArchiveIterator> NewMembers;<br>
> + if (!NewMembersP)<br>
> + NewMembers = computeNewArchiveMembers(Operation, OldArchive);<br>
> +<br>
> object::Archive::Kind Kind;<br>
> switch (FormatOpt) {<br>
> - case Default: {<br>
> - Triple T(sys::getProcessTriple());<br>
> - if (T.isOSDarwin() && !Thin)<br>
> - Kind = object::Archive::K_BSD;<br>
> - else<br>
> + case Default:<br>
> + if (Thin)<br>
> Kind = object::Archive::K_GNU;<br>
> + else if (OldArchive)<br>
> + Kind = OldArchive->kind();<br>
> + else if (NewMembersP)<br>
> + Kind = NewMembersP->size() ? getKindFromMember(NewMembersP->front())<br>
> + : getDefaultForHost();<br>
> + else<br>
> + Kind = NewMembers.size() ? getKindFromMember(NewMembers.front())<br>
> + : getDefaultForHost();<br>
> break;<br>
> - }<br>
> case GNU:<br>
> Kind = object::Archive::K_GNU;<br>
> break;<br>
> @@ -599,18 +665,10 @@ performWriteOperation(ArchiveOperation O<br>
> Kind = object::Archive::K_BSD;<br>
> break;<br>
> }<br>
> - if (NewMembersP) {<br>
> - std::pair<StringRef, std::error_code> Result = writeArchive(<br>
> - ArchiveName, *NewMembersP, Symtab, Kind, Deterministic, Thin,<br>
> - std::move(OldArchiveBuf));<br>
> - failIfError(Result.second, Result.first);<br>
> - return;<br>
> - }<br>
> - std::vector<NewArchiveIterator> NewMembers =<br>
> - computeNewArchiveMembers(Operation, OldArchive);<br>
> - auto Result =<br>
> - writeArchive(ArchiveName, NewMembers, Symtab, Kind, Deterministic, Thin,<br>
> - std::move(OldArchiveBuf));<br>
> +<br>
> + std::pair<StringRef, std::error_code> Result =<br>
> + writeArchive(ArchiveName, NewMembersP ? *NewMembersP : NewMembers, Symtab,<br>
> + Kind, Deterministic, Thin, std::move(OldArchiveBuf));<br>
> failIfError(Result.second, Result.first);<br>
> }<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature">Mike<br>Sent from phone</div>