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

FatArch64 #101

Closed
woodruffw opened this issue Jul 3, 2018 · 2 comments · Fixed by #103
Closed

FatArch64 #101

woodruffw opened this issue Jul 3, 2018 · 2 comments · Fixed by #103

Comments

@woodruffw
Copy link
Member

woodruffw commented Jul 3, 2018

It looks like Apple decided to introduce a new fat_arch without telling anybody:

/*
 * The support for the 64-bit fat file format described here is a work in
 * progress and not yet fully supported in all the Apple Developer Tools.
 *
 * When a slice is greater than 4mb or an offset to a slice is greater than 4mb
 * then the 64-bit fat file format is used.
 */
#define FAT_MAGIC_64	0xcafebabf
#define FAT_CIGAM_64	0xbfbafeca	/* NXSwapLong(FAT_MAGIC_64) */

struct fat_arch_64 {
	cpu_type_t	cputype;	/* cpu specifier (int) */
	cpu_subtype_t	cpusubtype;	/* machine specifier (int) */
	uint64_t	offset;		/* file offset to this object file */
	uint64_t	size;		/* size of this object file */
	uint32_t	align;		/* alignment as a power of 2 */
	uint32_t	reserved;	/* reserved */
};

Based on the comment, we'll probably need to support it soon.

Source: https://opensource.apple.com/source/cctools/cctools-895/include/mach-o/fat.h.auto.html

@woodruffw woodruffw changed the title FatHeader64 FatArch64 Jul 3, 2018
@UniqMartin
Copy link
Contributor

The second paragraph of the comment is most likely bogus, as it would make more sense to switch from 32 to 64 bit when crossing the 4 GiB size limit. (While it's difficult to find fat binaries on modern macOS, it's no problem to find non-fat binaries easily crossing the 4 MiB limit mentioned in the comment and I suspect some of them, e.g. iTunes, were bigger than 4 MiB per slice already a few years ago.) A quick peek at the lipo source confirms the size checks are actually against UINT32_MAX.

@woodruffw
Copy link
Member Author

A quick peek at the lipo source confirms the size checks are actually against UINT32_MAX.

Thanks for the check! I have to admit that I totally glazed over that part comment and just assumed that it was UINT32_MAX 😉

I'll probably fill this in this weekend.

woodruffw added a commit that referenced this issue Jul 8, 2018
woodruffw added a commit that referenced this issue Jul 10, 2018
@lock lock bot added the outdated label Jan 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants