site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com -- Terry On May 14, 2008, at 2:06 AM, MT <markturner@gmx.net> wrote: Thanks for any insight Mark _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/tlambert%40apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... According to the documentation on <http://developer.apple.com>, which you should probably read before you get too far into manipulating Mach- o files, the alignment is in memory. However, be aware that many people deal with "what works" rather than "what's documented", and therefore there could be all sorts of code making assumptions about physical layout of the file. As an example, when I did the 64 bit exec bringip in the kernel, I had the chicken and egg problem of not having 64 bit Mach-o binaries to load, and not being able to create them because I didn't have anything to load them with to know they had been created correctly. So I cheated; I "knew" that the Mach-o header was written in the first 4K, and I "knew" that the first 4K was incompletely used, and I "knew" that the first section after the header was aligned to a 4K boundary. Using these three assumptions not actually guaranteed anywhere in the ABI, I wrote a program to take a 32 bit Mach-o, convert the sections and load commands to 64 bit versions of themselves, and then proceeded to write code to load the resulting 32-in-64 binaries. The entire bringup of 64 bit exec was done on a dual G4, months before I had real G5 hardware. The normal admonition in these cases has been floationg around the IETF for years, but I'll repeat it here: be very strict in the data you generate, and as liberal as possible in the data you accept, if you want to ensure the highest probability of interoperability. I have a question about the section alignment specified in the load command in a mach-o file. Is the alignment only relevant for the virtual address, or also for the file offset? Some tests with otool seem to indicate that both the virtual address and the file offset seem to respect that alignment normally, but does it need to be this way? This email sent to tlambert@apple.com This email sent to site_archiver@lists.apple.com