All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Chen Jiqian <Jiqian.Chen@amd.com>
Subject: Re: [PATCH] x86: don't have gcc over-align data
Date: Mon, 21 Jul 2025 16:48:57 +0200	[thread overview]
Message-ID: <aH5TWXWFJ1IOH220@macbook.local> (raw)
In-Reply-To: <f68299c4-7aba-4bac-a50c-182f3cb5686e@suse.com>

On Wed, Jun 25, 2025 at 11:04:14AM +0200, Jan Beulich wrote:
> For (aiui) backwards compatibility reasons, gcc defaults to a mode that
> was the exclusive one up to gcc4.8, establishing 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@suse.com>
> 
> --- a/xen/arch/x86/arch.mk
> +++ b/xen/arch/x86/arch.mk
> @@ -8,6 +8,9 @@ CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFF
>  # 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

Instead of using CONFIG_CC_IS_GCC should be just use cc-option-add to
check for the option begin present, regardless of the underlying
compiler?

Thanks, Roger.


  parent reply	other threads:[~2025-07-21 14:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25  9:04 [PATCH] x86: don't have gcc over-align data Jan Beulich
2025-06-27  6:09 ` Jan Beulich
2025-07-21 14:48 ` Roger Pau Monné [this message]
2025-07-21 16:05   ` Jan Beulich
2025-07-21 16:26     ` Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aH5TWXWFJ1IOH220@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=Jiqian.Chen@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.