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

Add support for LC_NOTE and LC_BUILD_VERSION #25

Open
ronaldoussoren opened this issue Jul 2, 2018 · 1 comment
Open

Add support for LC_NOTE and LC_BUILD_VERSION #25

ronaldoussoren opened this issue Jul 2, 2018 · 1 comment
Labels
enhancement New feature or request major

Comments

@ronaldoussoren
Copy link
Owner

Original report by Laurent DORE (Bitbucket: ldore, GitHub: ldore).


iOs SDK 12 beta introduces the following two load commands in loader.h:

#define LC_NOTE 0x31 /* arbitrary data included within a Mach-O file */
#define LC_BUILD_VERSION 0x32 /* build for platform min OS version */

Where:

/*
 * LC_NOTE commands describe a region of arbitrary data included in a Mach-O
 * file.  Its initial use is to record extra data in MH_CORE files.
 */
struct note_command {
    uint32_t	cmd;		/* LC_NOTE */
    uint32_t	cmdsize;	/* sizeof(struct note_command) */
    char	data_owner[16];	/* owner name for this LC_NOTE */
    uint64_t	offset;		/* file offset of this data */
    uint64_t	size;		/* length of data region */
};

and:

/*
 * The build_version_command contains the min OS version on which this 
 * binary was built to run for its platform.  The list of known platforms and
 * tool values following it.
 */
struct build_version_command {
    uint32_t	cmd;		/* LC_BUILD_VERSION */
    uint32_t	cmdsize;	/* sizeof(struct build_version_command) plus */
                                /* ntools * sizeof(struct build_tool_version) */
    uint32_t	platform;	/* platform */
    uint32_t	minos;		/* X.Y.Z is encoded in nibbles xxxx.yy.zz */
    uint32_t	sdk;		/* X.Y.Z is encoded in nibbles xxxx.yy.zz */
    uint32_t	ntools;		/* number of tool entries following this */
};

struct build_tool_version {
    uint32_t	tool;		/* enum for the tool */
    uint32_t	version;	/* version number of the tool */
};

With :

/* Known values for the tool field above. */
#define TOOL_CLANG 1
#define TOOL_SWIFT 2
#define TOOL_LD	3

Supporting these load commands would be a step toward iOs 12 compatibility.

@ronaldoussoren
Copy link
Owner Author

Original comment by Ronald Oussoren (Bitbucket: ronaldoussoren, GitHub: ronaldoussoren).


changeset ff4fc2e668c4 has initial support for this.

I'd like to teach the python version of build_version_command about the list of build_tool_version elements in the load command before I do a release, but will to a release later this week regardless.

BTW. What do you use macholib for?

@ronaldoussoren ronaldoussoren added major enhancement New feature or request labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request major
Projects
None yet
Development

No branches or pull requests

1 participant