[llvm] r223343 - Add mach-o LC_RPATH support to llvm-objdump

Chandler Carruth chandlerc at google.com
Thu Dec 4 00:59:46 PST 2014


In particular, every build bot has been broken for an hour at this point.
Please revert or fix....

On Thu, Dec 4, 2014 at 12:55 AM, Charlie Turner <Charlie.Turner at arm.com>
wrote:

> Hi,
>
> I think you forgot to add the test/Object/Inputs/macho-rpath-x86_64 input
> file in your commit. I'm seeing test failures,
>
> /work/build-llvm-gitsvn/./bin/llvm-objdump:
> '/work/llvm-gitsvn/test/Object/Inputs/macho-rpath-x86_64': No such file
> FileCheck error: '-' is empty.
>
> Kind regards,
> Charlie.
>
> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:
> llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Jean-Daniel Dupas
> Sent: 04 December 2014 07:37
> To: llvm-commits at cs.uiuc.edu
> Subject: [llvm] r223343 - Add mach-o LC_RPATH support to llvm-objdump
>
> Author: jddupas
> Date: Thu Dec  4 01:37:02 2014
> New Revision: 223343
>
> URL: http://llvm.org/viewvc/llvm-project?rev=223343&view=rev
> Log:
> Add mach-o LC_RPATH support to llvm-objdump
>
> Summary: Add rpath load command support in Mach-O object and update
> llvm-objdump to use it.
>
> Subscribers: llvm-commits
>
> Differential Revision: http://reviews.llvm.org/D6512
>
> Modified:
>     llvm/trunk/include/llvm/Object/MachO.h
>     llvm/trunk/include/llvm/Support/MachO.h
>     llvm/trunk/lib/Object/MachOObjectFile.cpp
>     llvm/trunk/test/Object/objdump-private-headers.test
>     llvm/trunk/tools/llvm-objdump/MachODump.cpp
>
> Modified: llvm/trunk/include/llvm/Object/MachO.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=223343&r1=223342&r2=223343&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Object/MachO.h (original)
> +++ llvm/trunk/include/llvm/Object/MachO.h Thu Dec  4 01:37:02 2014
> @@ -360,6 +360,8 @@ public:
>    getDylinkerCommand(const LoadCommandInfo &L) const;
>    MachO::uuid_command
>    getUuidCommand(const LoadCommandInfo &L) const;
> +  MachO::rpath_command
> +  getRpathCommand(const LoadCommandInfo &L) const;
>    MachO::source_version_command
>    getSourceVersionCommand(const LoadCommandInfo &L) const;
>    MachO::entry_point_command
>
> Modified: llvm/trunk/include/llvm/Support/MachO.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MachO.h?rev=223343&r1=223342&r2=223343&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/MachO.h (original)
> +++ llvm/trunk/include/llvm/Support/MachO.h Thu Dec  4 01:37:02 2014
> @@ -1109,6 +1109,12 @@ namespace llvm {
>        sys::swapByteOrder(u.cmdsize);
>      }
>
> +    inline void swapStruct(rpath_command &r) {
> +      sys::swapByteOrder(r.cmd);
> +      sys::swapByteOrder(r.cmdsize);
> +      sys::swapByteOrder(r.path);
> +    }
> +
>      inline void swapStruct(source_version_command &s) {
>        sys::swapByteOrder(s.cmd);
>        sys::swapByteOrder(s.cmdsize);
>
> Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=223343&r1=223342&r2=223343&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
> +++ llvm/trunk/lib/Object/MachOObjectFile.cpp Thu Dec  4 01:37:02 2014
> @@ -2299,6 +2299,11 @@ MachOObjectFile::getUuidCommand(const Lo
>    return getStruct<MachO::uuid_command>(this, L.Ptr);  }
>
> +MachO::rpath_command
> +MachOObjectFile::getRpathCommand(const LoadCommandInfo &L) const {
> +  return getStruct<MachO::rpath_command>(this, L.Ptr); }
> +
>  MachO::source_version_command
>  MachOObjectFile::getSourceVersionCommand(const LoadCommandInfo &L) const {
>    return getStruct<MachO::source_version_command>(this, L.Ptr);
>
> Modified: llvm/trunk/test/Object/objdump-private-headers.test
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/objdump-private-headers.test?rev=223343&r1=223342&r2=223343&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/Object/objdump-private-headers.test (original)
> +++ llvm/trunk/test/Object/objdump-private-headers.test Thu Dec  4
> +++ 01:37:02 2014
> @@ -2,6 +2,8 @@ RUN: llvm-objdump -p %p/Inputs/program-h
>  RUN:              | FileCheck %s -check-prefix ELF-i386
>  RUN: llvm-objdump -p %p/Inputs/program-headers.elf-x86-64 \
>  RUN:              | FileCheck %s -check-prefix ELF-x86-64
> +RUN: llvm-objdump -p %p/Inputs/macho-rpath-x86_64 \
> +RUN:              | FileCheck %s -check-prefix MACHO-x86_64
>
>  ELF-i386: Program Header:
>  ELF-i386:     LOAD off    0x00000000 vaddr 0x08048000 paddr 0x08048000
> align 2**12
> @@ -16,3 +18,8 @@ ELF-x86-64: EH_FRAME off    0x0000000000
>  ELF-x86-64:          filesz 0x0000000000000014 memsz 0x0000000000000014
> flags r--
>  ELF-x86-64:    STACK off    0x0000000000000000 vaddr 0x0000000000000000
> paddr 0x0000000000000000 align 2**3
>  ELF-x86-64:          filesz 0x0000000000000000 memsz 0x0000000000000000
> flags rw-
> +
> +MACHO-x86_64: Load command 12
> +MACHO-x86_64:          cmd LC_RPATH
> +MACHO-x86_64:      cmdsize 32
> +MACHO-x86_64:         path @executable_path/. (offset 12)
>
> Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=223343&r1=223342&r2=223343&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
> +++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Thu Dec  4 01:37:02 2014
> @@ -3299,6 +3299,22 @@ static void PrintUuidLoadCommand(MachO::
>    outs() << "\n";
>  }
>
> +static void PrintRpathLoadCommand(MachO::rpath_command rpath,
> +                                  const char *Ptr) {
> +  outs() << "          cmd LC_RPATH\n";
> +  outs() << "      cmdsize " << rpath.cmdsize;
> +  if (rpath.cmdsize < sizeof(struct MachO::rpath_command))
> +    outs() << " Incorrect size\n";
> +  else
> +    outs() << "\n";
> +  if (rpath.path >= rpath.cmdsize)
> +    outs() << "         path ?(bad offset " << rpath.path << ")\n";
> +  else {
> +    const char *P = (const char *)(Ptr) + rpath.path;
> +    outs() << "         path " << P << " (offset " << rpath.path << ")\n";
> +  }
> +}
> +
>  static void PrintVersionMinLoadCommand(MachO::version_min_command vd) {
>    if (vd.cmd == MachO::LC_VERSION_MIN_MACOSX)
>      outs() << "      cmd LC_VERSION_MIN_MACOSX\n";
> @@ -3494,6 +3510,9 @@ static void PrintLoadCommands(const Mach
>      } else if (Command.C.cmd == MachO::LC_UUID) {
>        MachO::uuid_command Uuid = Obj->getUuidCommand(Command);
>        PrintUuidLoadCommand(Uuid);
> +    } else if (Command.C.cmd == MachO::LC_RPATH) {
> +      MachO::rpath_command Rpath = Obj->getRpathCommand(Command);
> +      PrintRpathLoadCommand(Rpath, Command.Ptr);
>      } else if (Command.C.cmd == MachO::LC_VERSION_MIN_MACOSX) {
>        MachO::version_min_command Vd =
> Obj->getVersionMinLoadCommand(Command);
>        PrintVersionMinLoadCommand(Vd);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy the
> information in any medium.  Thank you.
>
> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
> Registered in England & Wales, Company No:  2557590
> ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ,
> Registered in England & Wales, Company No:  2548782
>
>
> _______________________________________________
> 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/20141204/38b6528f/attachment.html>


More information about the llvm-commits mailing list