[llvm] r226228 - Add the option, -archive-headers, used with -macho to print the Mach-O archive headers to llvm-objdump.
Kevin Enderby
enderby at apple.com
Thu Jan 15 18:20:46 PST 2015
Hi Rafael,
Yep I’ve been trying to fix it with r226232 then r226239 and I have removed the test in r226241 while I try to figure what is is going on.
Sorry for the breakage,
Kev
P.S. Maybe I should have Cc’ed llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu> on this email I first sent when I saw the failure:
> Begin forwarded message:
>
> Subject: Re: buildbot failure in LLVM on clang-cmake-armv7-a15-full
> From: Kevin Enderby <enderby at apple.com>
> Date: January 15, 2015 at 4:15:02 PM PST
> Cc: Kevin Enderby <enderby at apple.com>
> To: llvm.buildmaster at lab.llvm.org
>
> I’m looking into this now.
>
> Kev
>
>> On Jan 15, 2015, at 4:08 PM, llvm.buildmaster at lab.llvm.org wrote:
>>
>> The Buildbot has detected a new failure on builder clang-cmake-armv7-a15-full while building llvm.
>> Full details are available at:
>> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/3165
>>
>> Buildbot URL: http://lab.llvm.org:8011/
>>
>> Buildslave for this Build: linaro-a15-03
>>
>> Build Reason: scheduler
>> Build Source Stamp: [branch trunk] 226228
>> Blamelist: arsenm,colinl,enderby,rafael
>>
>> BUILD FAILED: failed ninja check 1
>>
>> sincerely,
>> -The Buildbot
>>
>>
>>
>
> On Jan 15, 2015, at 6:15 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
>
> This is failing in a bot:
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/3165/steps/ninja%20check%201/logs/LLVM%3A%3Amacho-archive-headers.test
>
> On 15 January 2015 at 18:19, Kevin Enderby <enderby at apple.com> wrote:
>> Author: enderby
>> Date: Thu Jan 15 17:19:11 2015
>> New Revision: 226228
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=226228&view=rev
>> Log:
>> Add the option, -archive-headers, used with -macho to print the Mach-O archive headers to llvm-objdump.
>>
>> Added:
>> llvm/trunk/test/tools/llvm-objdump/X86/macho-archive-headers.test
>> Modified:
>> llvm/trunk/include/llvm/Object/Archive.h
>> llvm/trunk/lib/Object/Archive.cpp
>> llvm/trunk/tools/llvm-objdump/MachODump.cpp
>> llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
>> llvm/trunk/tools/llvm-objdump/llvm-objdump.h
>>
>> Modified: llvm/trunk/include/llvm/Object/Archive.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/Archive.h?rev=226228&r1=226227&r2=226228&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Object/Archive.h (original)
>> +++ llvm/trunk/include/llvm/Object/Archive.h Thu Jan 15 17:19:11 2015
>> @@ -41,6 +41,9 @@ struct ArchiveMemberHeader {
>>
>> sys::fs::perms getAccessMode() const;
>> sys::TimeValue getLastModified() const;
>> + llvm::StringRef getRawLastModified() const {
>> + return StringRef(LastModified, sizeof(LastModified)).rtrim(" ");
>> + }
>> unsigned getUID() const;
>> unsigned getGID() const;
>> };
>> @@ -78,6 +81,9 @@ public:
>> sys::TimeValue getLastModified() const {
>> return getHeader()->getLastModified();
>> }
>> + StringRef getRawLastModified() const {
>> + return getHeader()->getRawLastModified();
>> + }
>> unsigned getUID() const { return getHeader()->getUID(); }
>> unsigned getGID() const { return getHeader()->getGID(); }
>> sys::fs::perms getAccessMode() const {
>> @@ -85,10 +91,13 @@ public:
>> }
>> /// \return the size of the archive member without the header or padding.
>> uint64_t getSize() const;
>> + /// \return the size of the archive member with the header and padding.
>> + uint64_t getRawSize() const;
>>
>> StringRef getBuffer() const {
>> return StringRef(Data.data() + StartOfFile, getSize());
>> }
>> + uint64_t getChildOffset() const;
>>
>> ErrorOr<MemoryBufferRef> getMemoryBufferRef() const;
>>
>> @@ -194,6 +203,7 @@ public:
>> child_iterator findSym(StringRef name) const;
>>
>> bool hasSymbolTable() const;
>> + child_iterator getSymbolTableChild() const { return SymbolTable; }
>>
>> private:
>> child_iterator SymbolTable;
>>
>> Modified: llvm/trunk/lib/Object/Archive.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Archive.cpp?rev=226228&r1=226227&r2=226228&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Object/Archive.cpp (original)
>> +++ llvm/trunk/lib/Object/Archive.cpp Thu Jan 15 17:19:11 2015
>> @@ -110,6 +110,12 @@ uint64_t Archive::Child::getSize() const
>> return Data.size() - StartOfFile;
>> }
>>
>> +uint64_t Archive::Child::getRawSize() const {
>> + if (Parent->IsThin)
>> + return getHeader()->getSize();
>> + return Data.size();
>> +}
>> +
>> Archive::Child Archive::Child::getNext() const {
>> size_t SpaceToSkip = Data.size();
>> // If it's odd, add 1 to make it even.
>> @@ -125,6 +131,13 @@ Archive::Child Archive::Child::getNext()
>> return Child(Parent, NextLoc);
>> }
>>
>> +uint64_t Archive::Child::getChildOffset() const {
>> + const char *a = Parent->Data.getBuffer().data();
>> + const char *c = Data.data();
>> + uint64_t offset = c - a;
>> + return offset;
>> +}
>> +
>> ErrorOr<StringRef> Archive::Child::getName() const {
>> StringRef name = getRawName();
>> // Check if it's a special name.
>>
>> Added: llvm/trunk/test/tools/llvm-objdump/X86/macho-archive-headers.test
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/X86/macho-archive-headers.test?rev=226228&view=auto
>> ==============================================================================
>> --- llvm/trunk/test/tools/llvm-objdump/X86/macho-archive-headers.test (added)
>> +++ llvm/trunk/test/tools/llvm-objdump/X86/macho-archive-headers.test Thu Jan 15 17:19:11 2015
>> @@ -0,0 +1,10 @@
>> +RUN: llvm-objdump %p/Inputs/macho-universal-archive.x86_64.i386 -macho -archive-headers -arch all \
>> +RUN: | FileCheck %s
>> +
>> +# Note the date as printed by ctime(3) is time zone dependent and not checked.
>> +CHECK: Archive : {{.*}}/macho-universal-archive.x86_64.i386 (architecture x86_64)
>> +CHECK: -rw-r--r--124/11 44 {{.*}} __.SYMDEF SORTED
>> +CHECK: -rw-r--r--124/0 860 {{.*}} hello.o
>> +CHECK: Archive : {{.*}}/macho-universal-archive.x86_64.i386 (architecture i386)
>> +CHECK: -rw-r--r--124/11 60 {{.*}} __.SYMDEF SORTED
>> +CHECK: -rw-r--r--124/0 388 {{.*}} foo.o
>>
>> Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=226228&r1=226227&r2=226228&view=diff
>> ==============================================================================
>> --- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
>> +++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Thu Jan 15 17:19:11 2015
>> @@ -66,9 +66,14 @@ static cl::opt<bool>
>> PrintImmHex("print-imm-hex",
>> cl::desc("Use hex format for immediate values"));
>>
>> +cl::opt<bool> llvm::UniversalHeaders("universal-headers",
>> + cl::desc("Print Mach-O universal headers "
>> + "(requires -macho)"));
>> +
>> cl::opt<bool>
>> - llvm::UniversalHeaders("universal-headers",
>> - cl::desc("Print Mach-O universal headers"));
>> + llvm::ArchiveHeaders("archive-headers",
>> + cl::desc("Print archive headers for Mach-O archives "
>> + "(requires -macho)"));
>>
>> static cl::list<std::string>
>> ArchFlags("arch", cl::desc("architecture(s) from a Mach-O file to dump"),
>> @@ -514,6 +519,106 @@ static void printMachOUniversalHeaders(c
>> }
>> }
>>
>> +static void printArchiveChild(Archive::Child &C, bool verbose,
>> + bool print_offset) {
>> + if (print_offset)
>> + outs() << C.getChildOffset() << "\t";
>> + sys::fs::perms Mode = C.getAccessMode();
>> + if (verbose) {
>> + // FIXME: this first dash, "-", is for (Mode & S_IFMT) == S_IFREG.
>> + // But there is nothing in sys::fs::perms for S_IFMT or S_IFREG.
>> + outs() << "-";
>> + if (Mode & sys::fs::owner_read)
>> + outs() << "r";
>> + else
>> + outs() << "-";
>> + if (Mode & sys::fs::owner_write)
>> + outs() << "w";
>> + else
>> + outs() << "-";
>> + if (Mode & sys::fs::owner_exe)
>> + outs() << "x";
>> + else
>> + outs() << "-";
>> + if (Mode & sys::fs::group_read)
>> + outs() << "r";
>> + else
>> + outs() << "-";
>> + if (Mode & sys::fs::group_write)
>> + outs() << "w";
>> + else
>> + outs() << "-";
>> + if (Mode & sys::fs::group_exe)
>> + outs() << "x";
>> + else
>> + outs() << "-";
>> + if (Mode & sys::fs::others_read)
>> + outs() << "r";
>> + else
>> + outs() << "-";
>> + if (Mode & sys::fs::others_write)
>> + outs() << "w";
>> + else
>> + outs() << "-";
>> + if (Mode & sys::fs::others_exe)
>> + outs() << "x";
>> + else
>> + outs() << "-";
>> + } else {
>> + outs() << format("0%o ", Mode);
>> + }
>> +
>> + unsigned UID = C.getUID();
>> + outs() << format("%3d/", UID);
>> + unsigned GID = C.getGID();
>> + outs() << format("%-3d ", GID);
>> + uint64_t Size = C.getRawSize() - sizeof(object::ArchiveMemberHeader);
>> + outs() << format("%5d ", Size);
>> +
>> + StringRef RawLastModified = C.getRawLastModified();
>> + if (verbose) {
>> + unsigned Seconds;
>> + if (RawLastModified.getAsInteger(10, Seconds))
>> + outs() << "(date: \"%s\" contains non-decimal chars) " << RawLastModified;
>> + else {
>> + // Since cime(3) returns a 26 character string of the form:
>> + // "Sun Sep 16 01:03:52 1973\n\0"
>> + // just print 24 characters.
>> + time_t t = Seconds;
>> + outs() << format("%.24s ", ctime(&t));
>> + }
>> + } else {
>> + outs() << RawLastModified << " ";
>> + }
>> +
>> + if (verbose) {
>> + ErrorOr<StringRef> NameOrErr = C.getName();
>> + if (NameOrErr.getError()) {
>> + StringRef RawName = C.getRawName();
>> + outs() << RawName << "\n";
>> + } else {
>> + StringRef Name = NameOrErr.get();
>> + outs() << Name << "\n";
>> + }
>> + } else {
>> + StringRef RawName = C.getRawName();
>> + outs() << RawName << "\n";
>> + }
>> +}
>> +
>> +static void printArchiveHeaders(Archive *A, bool verbose, bool print_offset) {
>> + if (A->hasSymbolTable()) {
>> + Archive::child_iterator S = A->getSymbolTableChild();
>> + Archive::Child C = *S;
>> + printArchiveChild(C, verbose, print_offset);
>> + }
>> + for (Archive::child_iterator I = A->child_begin(), E = A->child_end(); I != E;
>> + ++I) {
>> + Archive::Child C = *I;
>> + printArchiveChild(C, verbose, print_offset);
>> + }
>> +}
>> +
>> // ParseInputMachO() parses the named Mach-O file in Filename and handles the
>> // -arch flags selecting just those slices as specified by them and also parses
>> // archive files. Then for each individual Mach-O file ProcessMachO() is
>> @@ -542,6 +647,8 @@ void llvm::ParseInputMachO(StringRef Fil
>>
>> if (Archive *A = dyn_cast<Archive>(&Bin)) {
>> outs() << "Archive : " << Filename << "\n";
>> + if (ArchiveHeaders)
>> + printArchiveHeaders(A, true, false);
>> for (Archive::child_iterator I = A->child_begin(), E = A->child_end();
>> I != E; ++I) {
>> ErrorOr<std::unique_ptr<Binary>> ChildOrErr = I->getAsBinary();
>> @@ -587,6 +694,8 @@ void llvm::ParseInputMachO(StringRef Fil
>> if (!ArchitectureName.empty())
>> outs() << " (architecture " << ArchitectureName << ")";
>> outs() << "\n";
>> + if (ArchiveHeaders)
>> + printArchiveHeaders(A.get(), true, false);
>> for (Archive::child_iterator AI = A->child_begin(),
>> AE = A->child_end();
>> AI != AE; ++AI) {
>> @@ -627,6 +736,8 @@ void llvm::ParseInputMachO(StringRef Fil
>> I->getAsArchive()) {
>> std::unique_ptr<Archive> &A = *AOrErr;
>> outs() << "Archive : " << Filename << "\n";
>> + if (ArchiveHeaders)
>> + printArchiveHeaders(A.get(), true, false);
>> for (Archive::child_iterator AI = A->child_begin(),
>> AE = A->child_end();
>> AI != AE; ++AI) {
>> @@ -662,6 +773,8 @@ void llvm::ParseInputMachO(StringRef Fil
>> if (!ArchitectureName.empty())
>> outs() << " (architecture " << ArchitectureName << ")";
>> outs() << "\n";
>> + if (ArchiveHeaders)
>> + printArchiveHeaders(A.get(), true, false);
>> for (Archive::child_iterator AI = A->child_begin(), AE = A->child_end();
>> AI != AE; ++AI) {
>> ErrorOr<std::unique_ptr<Binary>> ChildOrErr = AI->getAsBinary();
>>
>> Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp?rev=226228&r1=226227&r2=226228&view=diff
>> ==============================================================================
>> --- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp (original)
>> +++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp Thu Jan 15 17:19:11 2015
>> @@ -892,7 +892,8 @@ int main(int argc, char **argv) {
>> && !Bind
>> && !LazyBind
>> && !WeakBind
>> - && !(UniversalHeaders && MachOOpt)) {
>> + && !(UniversalHeaders && MachOOpt)
>> + && !(ArchiveHeaders && MachOOpt)) {
>> cl::PrintHelpMessage();
>> return 2;
>> }
>>
>> Modified: llvm/trunk/tools/llvm-objdump/llvm-objdump.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/llvm-objdump.h?rev=226228&r1=226227&r2=226228&view=diff
>> ==============================================================================
>> --- llvm/trunk/tools/llvm-objdump/llvm-objdump.h (original)
>> +++ llvm/trunk/tools/llvm-objdump/llvm-objdump.h Thu Jan 15 17:19:11 2015
>> @@ -35,6 +35,7 @@ extern cl::opt<bool> Bind;
>> extern cl::opt<bool> LazyBind;
>> extern cl::opt<bool> WeakBind;
>> extern cl::opt<bool> UniversalHeaders;
>> +extern cl::opt<bool> ArchiveHeaders;
>>
>> // Various helper functions.
>> bool error(std::error_code ec);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150115/53045faa/attachment.html>
More information about the llvm-commits
mailing list