[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] x86: don't have gcc over-align data



commit 77e27181e0c4cc5cf94752cdcbee5a70954c696d
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Jul 22 16:18:50 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jul 22 16:18:50 2025 +0200

    x86: don't have gcc over-align data
    
    For (aiui) backwards compatibility reasons, gcc defaults to a mode that
    was the exclusive one up to gcc4.8, establishing 16- or even 32-byte
    alignment for aggregates larger than a certain size. We don't rely on
    such, and hence we can do with the psABI-compliant 16-byte alignment.
    
    Savings in the build I'm looking at:
    - .data.ro_after_init            344 bytes
    - .rodata + .data.rel.ro        1904 bytes
    - .init.*data.cf_clobber         232 bytes
    - .init (overall)                688 bytes
    - .data.read_mostly              864 bytes
    - .data                          600 bytes
    - .bss                          1472 bytes
    
    Overall xen-syms' _end happens to move down there by 2 pages.
    
    Clang doesn't support the option, presumably because they never over-
    aligned data.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/arch.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk
index 594c268cad..7e83935201 100644
--- a/xen/arch/x86/arch.mk
+++ b/xen/arch/x86/arch.mk
@@ -8,6 +8,9 @@ CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET)
 # Prevent floating-point variables from creeping into Xen.
 CFLAGS += -msoft-float
 
+# Don't needlessly over-align larger aggregates.
+CFLAGS-$(CONFIG_CC_IS_GCC) += -malign-data=abi
+
 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
 $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
 $(call as-option-add,CFLAGS,CC,".equ \"x\"$(comma)1",-DHAVE_AS_QUOTED_SYM)
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.