Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for newer load commands #2

Open
jpstotz opened this issue Oct 13, 2021 · 7 comments
Open

Support for newer load commands #2

jpstotz opened this issue Oct 13, 2021 · 7 comments

Comments

@jpstotz
Copy link

jpstotz commented Oct 13, 2021

When I look into the source code the load command definitions seem to be a bit old, the latest LC is 0x30 where dyld already knows up to 0x34:
https://opensource.apple.com/source/cctools/cctools-927.0.2/include/mach-o/loader.h.auto.html

#define LC_NOTE 0x31 /* arbitrary data included within a Mach-O file */
#define LC_BUILD_VERSION 0x32 /* build for platform min OS version */
#define LC_DYLD_EXPORTS_TRIE (0x33 | LC_REQ_DYLD) /* used with linkedit_data_command, payload is trie */
#define LC_DYLD_CHAINED_FIXUPS (0x34 | LC_REQ_DYLD) /* used with linkedit_data_command */

The latter two replace starting with iOS15 LC_DYLD_INFO/LC_DYLD_INFO_ONLY
https://www.emergetools.com/blog/posts/iOS15LaunchTime

Sample app with LC_DYLD_EXPORTS_TRIE and LC_DYLD_CHAINED_FIXUPS:
nslogtest2.zip
e

@horsicq
Copy link
Owner

horsicq commented Oct 13, 2021

Thanks a lot for the report. I will take a look.

@horsicq
Copy link
Owner

horsicq commented Oct 19, 2021

I added the support. I will release a new verion of XMachOViewer in 2 weeks.

@horsicq horsicq closed this as completed Oct 19, 2021
@vmpsoft
Copy link

vmpsoft commented Jan 6, 2024

The latest released version (0.04) still doesn't show contents of LC_DYLD_EXPORTS_TRIE and LC_DYLD_CHAINED_FIXUPS

@jpstotz
Copy link
Author

jpstotz commented Jan 8, 2024

Meanwhile Apple has added again two new load-commands:

LC_FILESET_ENTRY = 0x35;
LC_ATOM_INFO = 0x36;

@horsicq horsicq reopened this Jan 23, 2024
@471595249
Copy link

The latest released version (0.04) still doesn't show contents of LC_VERSION_MIN_IPHONEOS.

@jpstotz
Copy link
Author

jpstotz commented May 13, 2024

Looking at the list of defined load-commands in https://github.com/horsicq/Formats/blob/master/xmach_def.h the following LCs are missing:

LC_SEGMENT_SPLIT_INFO = 0x1e
LC_REEXPORT_DYLIB = 0x1f
LC_DYLIB_CODE_SIGN_DRS = 0x2b
LC_FILESET_ENTRY = 0x35
LC_ATOM_INFO = 0x36

Not sure where the reverse lookup from constant to name is located. I have seen that for a lot of load commands there is code to handle them in machwidget.cpp. Is this the place where the load command parsing has to be implemented?
For generic load commands XMachOViewer does not parse the content it may be easier to have a lookup-table. That would avoid having to write an own if clause for each load command type.

@471595249
Copy link

Looking at the list of defined load-commands in https://github.com/horsicq/Formats/blob/master/xmach_def.h the following LCs are missing:

LC_SEGMENT_SPLIT_INFO = 0x1e
LC_REEXPORT_DYLIB = 0x1f
LC_DYLIB_CODE_SIGN_DRS = 0x2b
LC_FILESET_ENTRY = 0x35
LC_ATOM_INFO = 0x36

Not sure where the reverse lookup from constant to name is located. I have seen that for a lot of load commands there is code to handle them in machwidget.cpp. Is this the place where the load command parsing has to be implemented? For generic load commands XMachOViewer does not parse the content it may be easier to have a lookup-table. That would avoid having to write an own if clause for each load command type.

thanks! I got it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants