Closed barbeque closed 1 year ago
Hi Barbeque, actually it's even the other way round: this makes long doubles on M2 incompatible with AMD64. AMD64 has 16 byte long doubles (thereof 6 bytes unused) and i assume this is also true on Apple platform. And 64bit ARM somehow has them too but as you pointed out not on Apple. The reason is probably that AMD64 has hardware support and full library support for long double and ARM64 has not. ARM64 has only hardware support for double, and C and C++ libraries provided by ARM declare but don't implement many of the long double functions unless you use some open source versions which Apple probably didn't want to use for License reasons. So they fixed the problem by defining long double the same as double, which is perfectly legal in C/C++ terms but was unexpected/unknown to me. I added an #if switch to define long doubles to 8 bytes on Apple platforms. Thanks a lot for your report!
ARM docs: https://developer.arm.com/documentation/ka004751/1-0
For some reason (maybe easy compatibility with x86?) the
long double
type on a new MacBook Pro M2 is 8 and not 16.I'm building from the root of the
zasm
repository, withLibraries
checked out as a submodule.Apple mentions it in their own porting guide: https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Handle-data-types-and-data-alignment-properly
Thank you for the great assembler! I have used it for a bunch of projects and look forward to using it for many more.