All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Frediano Ziglio <frediano.ziglio@cloud.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2] x86/boot: Handle better alignment for 32 bit code
Date: Wed, 4 Feb 2026 17:10:18 +0100	[thread overview]
Message-ID: <0e2ceca5-8ab8-4c52-8a8a-b7dbdca50820@suse.com> (raw)
In-Reply-To: <20250114115430.104084-1-frediano.ziglio@cloud.com>

On 14.01.2025 12:54, Frediano Ziglio wrote:
> Output file didn't have correct alignment.

Coming back to this (as it's still in my "pending" folder), what does the above
mean? In how far was which alignment not correct for what purpose?

> --- a/xen/arch/x86/boot/Makefile
> +++ b/xen/arch/x86/boot/Makefile
> @@ -40,8 +40,12 @@ LD32 := $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT))
>  # are affected by both text_diff and text_gap.  Ensure the sum of gap and diff
>  # is greater than 2^16 so that any 16bit relocations if present in the object
>  # file turns into a build-time error.
> -text_gap := 0x010200
> -text_diff := 0x408020
> +# As gap will affect the output section size it should not be huge to avoid the
> +# creation of huge files.
> +# The sum of gap and diff will affect the possible alignment so should be a
> +# multiple of the possible alignment.
> +text_gap := 0x01c240
> +text_diff := 0x7e3dc0

It remains unclear what "possible alignment" here is. Maybe that's the "up to
2mb" that the description talks about, but when looking at the file later the
description of this change will not be readily available.

> @@ -80,6 +83,7 @@ cmd_combine = \
>                --bin1      $(obj)/built-in-32.base.bin \
>                --bin2      $(obj)/built-in-32.offset.bin \
>                --map       $(obj)/built-in-32.base.map \
> +              --align     $(shell $(OBJDUMP) -h $(obj)/built-in-32.base.o|sed '/text.*2\*\*/ {s/.*2\*\*//;p;}; d') \

I've tried this out manually on $(obj)/built-in-32.o, as $(obj)/built-in-32.base.o
isn't there without applying this patch. I'm observing two matching sections there,
i.e. I wonder whether the regex shouldn't be tightened. Not being fluent with sed
commands, I also wonder whether passing -n to the tool in favor of the d command
might not be better.

> @@ -90,4 +94,4 @@ $(obj)/built-in-32.S: $(obj)/built-in-32.base.bin $(obj)/built-in-32.offset.bin
>                        $(srctree)/tools/combine_two_binaries.py FORCE
>  	$(call if_changed,combine)
>  
> -clean-files := built-in-32.*.bin built-in-32.*.map build32.*.lds
> +clean-files := built-in-32.*.bin built-in-32.*.map built-in-32.*.o build32.*.lds

As before I think this is a separate bugfix anyway.

Jan


      parent reply	other threads:[~2026-02-04 16:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 11:54 [PATCH v2] x86/boot: Handle better alignment for 32 bit code Frediano Ziglio
2025-01-28 11:02 ` Frediano Ziglio
2026-02-04 16:10 ` Jan Beulich [this message]

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=0e2ceca5-8ab8-4c52-8a8a-b7dbdca50820@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=frediano.ziglio@cloud.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --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.