mfentry and Darwin.
Iain Sandoe
iain@sandoe.co.uk
Tue May 21 16:15:00 GMT 2019
Hi Uros,
It seems to me that (even if it was working “properly”, which it isn't) ‘-mfentry’ would break ABI on Darwin for both 32 and 64b - which require 16byte stack alignment at call sites.
For Darwin, the dynamic loader enforces the requirement when it can and will abort a program that tries to make a DSO linkage with the stack in an incorrect alignment. We previously had a bug against profiling caused by exactly this issue (but when the mcount call was in the post-prologue position).
Actually, I’m not sure why it’s not an issue for other 64b platforms that use the psABI (AFAIR, it’s only the 32b case that’s Darwin-specific).
Anyway, my current plan is to disable mfentry (for Darwin) - the alternative might be some kind of “almost at the start of the function, but needing some stack alignment change”,
I’m interested in if you know of any compelling use-cases that would make it worth finding some work-around instead of disabling.
thanks
Iain
More information about the Gcc
mailing list