When I run otool -favh some/library.so
there are the following fields:
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 X86_64 ALL LIB64 EXECU开发者_如何学JAVATE 12 1552 NOUNDEFS DYLDLINK TWOLEVEL
- What is the meaning of the "caps" column?
- Would the caps column being different cause linking failures?
Good question. Not documented anywhere, it seems. Thanks to open-source, though, the answer was available in the source code for otools, so you can look there if you need more information.
The field represents the capability bits of the CPU (that is cpusubtype & CPU_SUBTYPE_MASK
). So it is really a subset of the cpusubtype field, to make that information more readily available, I suppose. It is something the otools programmer(s) put in, and not a part of the Mach-O header.
Would the caps column being different cause linking failures?
Not sure if I get your question here, linking what exactly? Having two libraries compiled for different processors (thus possibly with different "caps" fields) and trying to link them together might be an issue, obviously. I would be more concerned with the "cputype" field in that regard, though. It will probably give you a hint if you are linking x86 code with ARM code (more so than the "caps" field, I'd guess).
In general, I would not concentrate too much on a field that nobody even cares to mention in any documentation, unless your particular situation demands it.
精彩评论