Re:Dissecting objc_msgSend on ARM64
by cyphar on Saturday July 01, 2017 @09:37AM
(#14677051)
> > objc_msgSend is written in assembly. There are two reasons for this: one is that it's not possible to write a function which preserves unknown arguments and jumps to an arbitrary function pointer in C.
> Wow... this is a bit off topic but can anyone expand on this side note and explain why?
I believe it's because C's variadic argument function call interface is not the same as the fixed-arguments function call interface so you can't just cast a function pointer to a variadic function pointer. And even if it worked on some architectures it sure as hell would not be standards compliant code.
> Wow... this is a bit off topic but can anyone expand on this side note and explain why?
I believe it's because C's variadic argument function call interface is not the same as the fixed-arguments function call interface so you can't just cast a function pointer to a variadic function pointer. And even if it worked on some architectures it sure as hell would not be standards compliant code.