[x264-devel] [Question] Technical reason why x264 sets a mstack-alignment value on compile time?

Nomis101 Nomis101 at web.de
Sun Nov 13 13:52:47 UTC 2022


Am 12.11.22 um 22:03 schrieb Henrik Gramner:
> On Sat, Nov 12, 2022 at 8:05 PM Nomis101 <Nomis101 at web.de> wrote:
>> And here comes my questions. I was wondering, about the technical reason why x264 does set
>> mstack-alignment? And if it would be safe to disable it in case x264 is compiled with ThinLTO (for
>> HandBrake)?
>
> The purpose is to avoid having to realign the stack in every function
> that uses aligned stack buffers by realigning the stack only once (on
> API entrypoints) and then maintaining that alignment.
>
> It's safe to remove it as long as you also remove the corresponding
> entry from ASFLAGS. Doing so will result in the system default being
> used, and stack realignment will be performed when needed.
>
> Note that the last time I checked using LTO had a negative impact on
> performance in x264, so unless it has improved recently it's not
> really recommended.

Thank you very much for your detailed answer.  Removing also the ASFLAG part does fix the error.
Thanks for pointing out the negative impact. I haven't been able to see that in my testing on macOS
yet, but we'll keep an eye on it. Nevertheless, this doesn't stop people from using LTO, so we'd
like to fix the error.


> _______________________________________________
> x264-devel mailing list
> x264-devel at videolan.org
> https://mailman.videolan.org/listinfo/x264-devel



More information about the x264-devel mailing list