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: Frediano Ziglio <frediano.ziglio@cloud.com>,
	xen-devel@lists.xenproject.org,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH v6 1/5] x86/boot: create a C bundle for 32 bit boot code and use it
Date: Fri, 18 Oct 2024 14:55:14 +0200	[thread overview]
Message-ID: <ZxJasvLomAlvMEws@macbook.local> (raw)
In-Reply-To: <7afb8389-3758-4633-a97a-3623513dc917@suse.com>

On Fri, Oct 18, 2024 at 02:04:22PM +0200, Jan Beulich wrote:
> On 18.10.2024 13:41, Roger Pau Monné wrote:
> > On Thu, Oct 17, 2024 at 02:31:19PM +0100, Frediano Ziglio wrote:
> >> @@ -25,14 +23,47 @@ $(obj32): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
> >>  $(obj)/%.32.o: $(src)/%.c FORCE
> >>  	$(call if_changed_rule,cc_o_c)
> >>  
> >> +orphan-handling-$(call ld-option,--orphan-handling=error) := --orphan-handling=error
> >>  LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
> >>  LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
> >>  LD32 := $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT))
> >>  
> >> -%.bin: %.lnk
> >> -	$(OBJCOPY) -j .text -O binary $< $@
> >> +text_gap := 0x010200
> >> +text_diff := 0x408020
> >> +
> >> +$(obj)/build32.base.lds: AFLAGS-y += -DGAP=$(text_gap) -DTEXT_DIFF=$(text_diff)
> >> +$(obj)/build32.offset.lds: AFLAGS-y += -DGAP=$(text_gap) -DTEXT_DIFF=$(text_diff) -DFINAL
> >> +$(obj)/build32.base.lds $(obj)/build32.offset.lds: $(src)/build32.lds.S FORCE
> >> +	$(call if_changed_dep,cpp_lds_S)
> >> +
> >> +targets += build32.offset.lds build32.base.lds
> >> +
> >> +# link all 32bit objects together
> >> +$(obj)/built-in-32.tmp.o: $(obj32)
> >> +	$(LD32) -r -o $@ $^
> >> +
> >> +# link bundle with a given layout and extract a binary from it
> >> +$(obj)/built-in-32.%.bin: $(obj)/build32.%.lds $(obj)/built-in-32.tmp.o
> >> +	$(LD32) $(orphan-handling-y) -N -T $< -Map $(@:bin=map) -o $(@:bin=o) $(filter %.o,$^)
> >> +	$(OBJCOPY) -j .text -O binary $(@:bin=o) $@
> >> +	rm -f $(@:bin=o)
> >> +
> >> +quiet_cmd_combine = GEN     $@
> >> +cmd_combine = \
> >> +	$(PYTHON) $(srctree)/tools/combine_two_binaries.py \
> >> +		--gap=$(text_gap) --text-diff=$(text_diff) \
> >> +		--script $(obj)/build32.offset.lds \
> >> +		--bin1 $(obj)/built-in-32.base.bin \
> >> +		--bin2 $(obj)/built-in-32.offset.bin \
> >> +		--map $(obj)/built-in-32.offset.map \
> >> +		--exports cmdline_parse_early,reloc \
> >> +		--output $@
> > 
> > See xen/Rules.mk, for consistency the indentation should be done with
> > spaces when defining variables.  That would also allow to align the
> > options.
> 
> And ideally also such that the options align with the first program
> argument.

Yup, that's what I was attempting to suggest, sorry if it wasn't
clear.

> >> +
> >> +targets += built-in-32.S
> >>  
> >> -%.lnk: %.32.o $(src)/build32.lds
> >> -	$(LD32) -N -T $(filter %.lds,$^) -o $@ $<
> >> +# generate final object file combining and checking above binaries
> >> +$(obj)/built-in-32.S: $(obj)/built-in-32.base.bin $(obj)/built-in-32.offset.bin \
> >> +		$(srctree)/tools/combine_two_binaries.py FORCE
> > 
> > Can you indent this using spaces also, so it's on the same column as
> > the ':'?
> 
> The first $(obj) you mean, I think / hope?

Indeed, it's one space after the ':':

# Generate final object file combining and checking above binaries
$(obj)/built-in-32.S: $(obj)/built-in-32.base.bin $(obj)/built-in-32.offset.bin \
                      $(srctree)/tools/combine_two_binaries.py FORCE

Preferably comments should also start with an uppercase letter.

Note this already exceeds the 80 char maximum, as the longest line is
81.  I think we have been a bit lax with Makefiles however.

Thanks, Roger.


  reply	other threads:[~2024-10-18 12:55 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 13:31 [PATCH v6 0/5] Reuse 32 bit C code more safely Frediano Ziglio
2024-10-17 13:31 ` [PATCH v6 1/5] x86/boot: create a C bundle for 32 bit boot code and use it Frediano Ziglio
2024-10-17 16:00   ` Anthony PERARD
2024-10-18 12:42     ` Frediano Ziglio
2024-10-17 17:13   ` Andrew Cooper
2024-10-18  8:42     ` Frediano Ziglio
2024-10-18 11:49       ` Roger Pau Monné
2024-10-18 13:28         ` Frediano Ziglio
2024-10-21  8:52           ` Roger Pau Monné
2024-10-18 11:41   ` Roger Pau Monné
2024-10-18 12:04     ` Jan Beulich
2024-10-18 12:55       ` Roger Pau Monné [this message]
2024-10-18 12:48     ` Frediano Ziglio
2024-10-18 12:59       ` Roger Pau Monné
2024-10-18 13:45         ` Frediano Ziglio
2024-10-21  8:01           ` Roger Pau Monné
2024-10-17 13:31 ` [PATCH v6 2/5] x86/boot: Reuse code to relocate trampoline Frediano Ziglio
2024-10-17 14:54   ` Marek Marczykowski-Górecki
2024-10-17 13:31 ` [PATCH v6 3/5] x86/boot: Use boot_vid_info variable directly from C code Frediano Ziglio
2024-10-17 13:31 ` [PATCH v6 4/5] x86/boot: Use trampoline_phys " Frediano Ziglio
2024-10-17 13:31 ` [PATCH v6 5/5] x86/boot: Clarify comment Frediano Ziglio

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=ZxJasvLomAlvMEws@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=frediano.ziglio@cloud.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --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.