Mac load commands corruption

陌路散爱 提交于 2019-12-12 10:56:39

问题


Signing (codesign) on one of our app is failing with malformed object (unknown load command 9). After doing some research online I found that load commands are special commands in executable's header that are used by kernel for segment loading ( http://0xfe.blogspot.in/2006/03/how-os-x-executes-applications.html ). So, I ran otool -l command on my app. Where I found that and command 30 were corrupt. But, launching app works absolutely fine.

How can I resolve this issue? I have no idea about how other team built that app.

The otool -l command snippet

.
.
.
.

Load command 8
     cmd LC_UUID
 cmdsize 24
   uuid F892472C-7463-3549-8FA0-A93F4501FB40
Load command 9
      cmd ?(0x00000024) Unknown load command
  cmdsize 16
000a0600 00000000 
Load command 10
        cmd LC_UNIXTHREAD
    cmdsize 184
     flavor x86_THREAD_STATE64
      count x86_THREAD_STATE64_COUNT
   rax  0x0000000000000000 rbx 0x0000000000000000 rcx  0x0000000000000000
   rdx  0x0000000000000000 rdi 0x0000000000000000 rsi  0x0000000000000000
   rbp  0x0000000000000000 rsp 0x0000000000000000 r8   0x0000000000000000
    r9  0x0000000000000000 r10 0x0000000000000000 r11  0x0000000000000000
   r12  0x0000000000000000 r13 0x0000000000000000 r14  0x0000000000000000
   r15  0x0000000000000000 rip 0x0000000100001970
rflags  0x0000000000000000 cs  0x0000000000000000 fs   0x0000000000000000
    gs  0x0000000000000000

.
.
.
.
.
.
Load command 29
          cmd LC_LOAD_DYLIB
      cmdsize 88
         name /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (offset 24)
   time stamp 2 Thu Jan  1 05:30:02 1970
      current version 1038.36.0
compatibility version 45.0.0
Load command 30
      cmd ?(0x00000026) Unknown load command
  cmdsize 16
001bd748 00000ef8 

回答1:


@Gagandeep Singh already figured out a solution, but for others who come across this question:

"Unknown load command" errors can happen when an object is built for one Mac OS X version and then used on an earlier Mac OS X version.

Mac OS X 10.6 introduced load command LC_DYLD_INFO_ONLY (0×80000022). To fix problems with that, see here.

Mac OS X 10.7 introduced load commands LC_VERSION_MIN_MACOSX (0×80000024) and LC_FUNCTION_STARTS (0x80000026). To fix problems with those, see here.

A handy list of load command names is in mach-o/loader.h.



来源:https://stackoverflow.com/questions/9496100/mac-load-commands-corruption

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!