According to Wikipedia, the NX bit is set for all x64 binaries:
OS X for Intel supports the NX bit on all CPUs supported by Apple (from 10.4.4 – the first Intel release – onwards). Mac OS X 10.4 only supported NX stack protection. In Mac OS X 10.5, all 64-bit executables have NX stack and heap; W^X protection. This includes x86-64 (Core 2 or later) and 64-bit PowerPC on the G5 Macs.
However, what if the executable is is not 64 bit: Mach-O executable i386
?
Similarly, for ASLR, Wikipedia says that it's enabled by default for 10.7 and up:
In Mac OS X Lion 10.7 (released July 2011), Apple expanded their implementation to cover all applications, stating "address space layout randomization (ASLR) has been improved for all applications. It is now available for 32-bit apps (as are heap memory protections), making 64-bit and 32-bit applications more resistant to attack."
Does this mean there is no way to opt-out of it via a compiler option? If there is, how could I verify that the application has not? Are there any analogies to Windows, where some libraries may be ASLR-ed, but others not?