[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v6 2/3] xen: use explicit function alignment if supported by compiler
Ping? On Wed, Feb 07, 2024 at 03:55:46PM +0100, Roger Pau Monne wrote: > Introduce a new Kconfig check for whether the compiler supports > -falign-functions and if supported use it to align functions to the per-arch > selected value, just like it's done for assembly ENTRY() and FUNC() symbols. > > Note that it's possible for the compiler to end up using a higher function > alignment regardless of the passed value. Different compilers handle the > option differently, as clang will ignore -falign-functions value if it's > smaller than the one that would be set by the optimization level, while gcc > seems to always honor the function alignment passed in -falign-functions. > > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> > --- > Changes since v5: > - New in this version. > --- > xen/Kconfig | 5 +++++ > xen/Makefile | 1 + > 2 files changed, 6 insertions(+) > > diff --git a/xen/Kconfig b/xen/Kconfig > index 1e1b041fd52f..040cba1b4b73 100644 > --- a/xen/Kconfig > +++ b/xen/Kconfig > @@ -41,6 +41,11 @@ config CC_SPLIT_SECTIONS > # > # Allow setting on a boolean basis, and then convert such selection to an > # integer for the build system and code to consume more easily. > +# > +# Requires clang >= 7.0.0 > +config CC_HAS_FUNCTION_ALIGNMENT > + def_bool $(cc-option,-falign-functions) > + > config FUNCTION_ALIGNMENT_4B > bool > config FUNCTION_ALIGNMENT_8B > diff --git a/xen/Makefile b/xen/Makefile > index 21832d640225..7c8249ab3a33 100644 > --- a/xen/Makefile > +++ b/xen/Makefile > @@ -390,6 +390,7 @@ CFLAGS += -fomit-frame-pointer > endif > > CFLAGS-$(CONFIG_CC_SPLIT_SECTIONS) += -ffunction-sections -fdata-sections > +CFLAGS-$(CONFIG_CC_HAS_FUNCTION_ALIGNMENT) += > -falign-functions=$(CONFIG_FUNCTION_ALIGNMENT) > > CFLAGS += -nostdinc -fno-builtin -fno-common > CFLAGS += -Werror -Wredundant-decls -Wwrite-strings -Wno-pointer-arith > -- > 2.43.0 >
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |