site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com
On Oct 10, 2017, at 9:08 PM, Daniel Peebles <pumpkingod@gmail.com> wrote:
Hi all,
I'm trying to understand the purpose of the EXTERNAL_HEADERS folder in the XNU releases. I'm currently struggling to compile XNU 3248.60.10's libsyscall and my build is getting thrown off by the asm_help.h inside EXTERNAL_HEADERS, which tries to inject i386 code into my x86_64 syscall wrappers.
As an example, see https://opensource.apple.com/source/xnu/xnu-3248.60.10/EXTERNAL_HEADERS/arch...
<https://opensource.apple.com/source/xnu/xnu-3248.60.10/EXTERNAL_HEADERS/architecture/i386/asm_help.h.auto.html>, which defines a PICIFY macro near the bottom. The one in there unconditionally runs popl %edx, which isn't valid in 64-bit mode.
If instead we compare the same asm_help.h from https://opensource.apple.com/source/architecture/architecture-268/i386/asm_h...
<https://opensource.apple.com/source/architecture/architecture-268/i386/asm_help.h.auto.html> (which comes from the same macOS release, 10.11.6), the same PICIFY macro correctly branches based on architecture and runs a far more appropriate movq var@GOTPCREL(%rip),%r11 on 64-bit intel.
This doesn't seem to affect most builds of XNU (such as those Shantonu Sen so helpfully explains on his blog) because the standard macOS SDKs include the more moderbn asm_help.h in the standard headers.
That leaves me wondering why EXTERNAL_HEADERS is provided in the first place, since it feels very confusing to those of us compiling in non-standard environments. It never seems to change (even the new darwin-xnu project on GitHub with the 10.13 kernel sources still has the old 32-bit file: https://github.com/apple/darwin-xnu/blob/master/EXTERNAL_HEADERS/architectur...
Can anyone shed light on these apparent discrepancies?
The old copy of asm_help.h in xnu's EXTERNAL_HEADERS is probably leftover historical cruft. I bet libsyscall is expecting the more recent asm_help.h file from Darwin's 'architecture' project. https://opensource.apple.com/source/architecture/architecture-268/ <https://opensource.apple.com/source/architecture/architecture-268/> -- Greg Parker gparker@apple.com <mailto:gparker@apple.com> Runtime Wrangler _______________________________________________ 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: https://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.app... This email sent to site_archiver@lists.apple.com