https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88345

--- Comment #14 from Mark Rutland <mark at kernel dot org> ---
> Patch posted before, but seems like not everybody agree:
> https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603049.html

FWIW, from the arm64 kernel side all we need is a reliable mechanism to align
functions, so the `-malign-all-function` or `-falign-all-functions` options Jan
suggests there would be good enough going forwards. It's just unfortunate that
we don't currently have a reliable mechanism (and have to workaround that by
avoiding the use of `-Os` and the `__cold__` attribute), and I guess the new
option would not be back-ported to stable GCC releases.

I don't think we want this hidden behind a `-flive-patching` option, since may
also want the alignment when not live-patching (e.g. for our
DEBUG_FORCE_FUNCTION_ALIGN_64B option), and the arch-specific details vary
quite drastically (e.g. arm64 uses `-fpatchable-function-entry=M,N`, x86 uses
`-mfentry` for patching and `-fpatchable-function-entry` for some CFI-related
logic), and those details are liable to change over time. Being able to set the
alignment independent from those details is likely to be more future-proof.

If it's intended that '-falign-functions=N' is overridden in some cases, it
would be nice to have that more clearly documented.

Reply via email to