From: Jan Beulich <jbeulich@suse.com>
To: Anthony PERARD <anthony.perard@vates.tech>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Michal Orzel" <michal.orzel@amd.com>,
"Roger Pau Monné" <roger@xenproject.org>,
"Teddy Astie" <teddy.astie@vates.tech>
Subject: Re: [PATCH v2 1/7] x86: split xen-syms/xen.efi linking rules
Date: Thu, 3 Sep 2026 09:26:46 +0200 [thread overview]
Message-ID: <4f99f95c-dadd-4f6e-b444-67f2eaa3fe47@suse.com> (raw)
In-Reply-To: <1788360748.8631fc262581453bbf619ec5b2062170.1a0629b6e88000c4f3@vates.tech>
On 02.09.2026 16:52, Anthony PERARD wrote:
> On Wed, Aug 26, 2026 at 02:00:22PM +0200, Jan Beulich wrote:
>> Doing so, besides (hopefully) adding clarity (not the least by way of
>> using pattern rules where possible), also avoids explicit recursive
>> $(MAKE) invocations. For xen-syms move re-usable helper rules to a new
>> scripts/Makefile.link.
>>
>> While doing so, re-order .map file creation (which can in principle fail)
>> and check-endbr.sh invocation ahead of putting in place the final image
>> (which is now the result of a simple rename).
>>
>> Also drop --source-name= from the tools/symbols invocation which has
>> --empty passed, for being meaningless there.
>>
>> Note that the original "rm" at the end of the rule needs limiting:
>> Removing intermediate files (which $(MAKE) doesn't itself remove) would
>> cause re-linking even when installing as root (when common/version.o is
>> left unaltered, and hence an incremental build should do nothing as long
>> as nothing else changed in the source tree).
>
> But as far as I can tell, both `rm` command are still the same,
> unaltered. And both command do removes file mark as intermediate via
> .INTERMEDIATE, before make would do so. Without the `rm` commands, make
> would leave alone ".xen*.*.o.sym" and "..xen*.*.o.d".
Oh, I'm sorry - this paragraph is stale from v1. I've now dropped it.
>> --- a/xen/arch/x86/Makefile
>> +++ b/xen/arch/x86/Makefile
>> @@ -102,12 +102,6 @@ notes_phdrs = --notes
>> +LAST_LINKING_PASS := 2
>> +
>> +final-image-check-$(CONFIG_XEN_IBT) = $(SHELL) $(srctree)/tools/check-endbr.sh $<
>
> How about removing $< from this macro, and letting the users of
> $(final-image-check-y) decide which argument to use?
I did consider doing so, but decided against: The placement of the argument
within the command may (in principle) matter. Now that you also mention this,
I think I'll switch to
final-image-check-$(CONFIG_XEN_IBT) = $(SHELL) $(srctree)/tools/check-endbr.sh $(1)
using
$(call final-image-check-y, $<)
at the use sites.
>> @@ -191,51 +165,69 @@ note_file_option ?= $(note_file)
>>
>> extra-$(XEN_BUILD_PE) += efi.lds
>> ifeq ($(XEN_BUILD_PE),y)
>> -$(TARGET).efi: $(obj)/efi/relocs-dummy.o $(obj)/efi/relocs-empty.o $(obj)/efi/mkreloc
>> -$(TARGET).efi: $(objtree)/prelink.o $(note_file) $(obj)/efi.lds
>> +
>> +.INTERMEDIATE: $(addprefix .$(TARGET).efi., \
>> + $(foreach n, 0 1 2, \
>> + $(n) alt.$(n) $(n)r.o $(n)s.o $(n)r.S $(n)s.S))
>> +
>> +.$(TARGET).efi.%.o: .$(TARGET).efi.%.S FORCE
>
> Left over "FORCE" from v1. Without if_changed we should let make decide
> to execute the recipe or not.
Oh, indeed. The adjustments to the xen.efi machinery were done merely
to mirror the xen-syms ones; they weren't strictly necessary to do
(and hence this went unnoticed).
>> + $(call cmd,cc_o_S)
>> +
>> +.$(TARGET).efi.1r.S: .$(TARGET).efi.0 $(if $(relocs-dummy),.$(TARGET).efi.alt.0)
>> +.$(TARGET).efi.2r.S: .$(TARGET).efi.1 $(if $(relocs-dummy),.$(TARGET).efi.alt.1)
>> +
>> +.$(TARGET).efi.0r.o: $(obj)/efi/relocs-dummy.o $(obj)/efi/mkreloc
>> + ln -sf $< $@
>
> Why mkreloc is a prerequisite of this rule? It's not use here.
>
> It could be move to the next rule, where it is actually used, and we
> could use order-only prerequisite, so $^ won't be altered. I've check,
> order-only prereq where introduced in make 3.80 according to the
> changelog of 3.81. And they are not part of the $^ variable.
>
> But the target won't get rebuilt if mkreloc is changed. So order-only
> might not be the right type of prerequisite.
Indeed, it wants to be a real prereq. And rather than ...
>> +.$(TARGET).efi.%r.S:
>> + $(MKRELOC) $^ > $@
... filtering it out of $^ I think it's easier the way it is. I can add a
comment, unless you think I need to move it here and do the filtering.
But wait - it really needs to move here, as the tool having been rebuilt
needs to cause rebuilding of these .S files (while .$(TARGET).efi.0r.o
wouldn't change at all).
>> +.$(TARGET).efi.0s.S:
>> + $(objtree)/tools/symbols $(all_symbols) --empty > $@
>> +
>> +.$(TARGET).efi.1s.S: .$(TARGET).efi.0
>> +.$(TARGET).efi.2s.S: .$(TARGET).efi.1
>> +
>> +.$(TARGET).efi.%s.S:
>> + $(NM) -pa --format=sysv $< \
>> + | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
>> + --source-name=$(TARGET).efi.S \
>> + > $@
>> +
>> +# See above for why $(note_file) needs removing here.
>> +efi-objs = $(filter-out $(note_file),$(filter %.o,$^))
>> +
>> +.$(TARGET).efi.%: $(objtree)/prelink.o .$(TARGET).efi.%r.o \
>> + .$(TARGET).efi.%s.o $(note_file) $(obj)/efi.lds
>> + $(LD) $(call EFI_LDFLAGS,$(VIRT_BASE)) -T $(obj)/efi.lds $(efi-objs) \
>> + --strip-debug $(note_file_option) -o $@
>
> This command have changed compared to what we have currently, for the
> step ".xen.efi.0". In the case where $(relocs-dummy) is empty, this
> command doesn't have relocs-dummy.o on the command line. With this patch,
> the object is added, via .xen.efi.1r.o. Is this fine?
For .xen.efi.0 it's .xen.efi.0r.o, and the rule for the latter is making
a symlink to relocs-dummy.o.
>> --- /dev/null
>> +++ b/xen/scripts/Makefile.link
>> @@ -0,0 +1,51 @@
>> +# SPDX-License-Identifier: GPL-2.0
>> +# ==========================================================================
>> +# Helper rules for linking xen-syms
>> +# ==========================================================================
>> +
>> +syms-warn-dup-y := --warn-dup
>> +syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS) :=
>> +syms-warn-dup-$(CONFIG_ENFORCE_UNIQUE_SYMBOLS) := --error-dup
>> +
>> +orphan-handling-$(call ld-option,--orphan-handling=warn) := --orphan-handling=warn
>> +
>> +final-image-check-y ?= true
>> +
>> +.INTERMEDIATE: $(addprefix .$(TARGET)-syms.,$(foreach n,0 1 2 3,$(n) $(n).o $(n).S))
>> +
>> +.$(TARGET)-syms.%.o: .$(TARGET)-syms.%.S
>> + $(call cmd,cc_o_S)
>
> That recipe change slight we what's currently in tree, there's now
> "-DXEN_BUILD_EFI -DBUILD_ID_EFI", but that's probably fine, CFLAGS-y
> from xen/arch/x86/Makefile are now taken into account. (That's
> likely the case also for .xen.efi.%.o but I haven't checked.)
Yes, the same applies there, and yes, the two extra -D are entirely
benign (and strictly speaking more correct, if either would matter for
these .S files; right now xen.lds.S is their only consumer).
Jan
next prev parent reply other threads:[~2026-09-03 7:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 11:57 [PATCH v2 0/7] build: split and unify linking of final image(s) Jan Beulich
2026-08-26 12:00 ` [PATCH v2 1/7] x86: split xen-syms/xen.efi linking rules Jan Beulich
2026-09-02 14:52 ` Anthony PERARD
2026-09-03 7:26 ` Jan Beulich [this message]
2026-08-26 12:00 ` [PATCH v2 2/7] Arm: split xen-syms linking rule Jan Beulich
2026-09-02 16:32 ` Anthony PERARD
2026-09-03 7:35 ` Jan Beulich
2026-08-26 12:01 ` [PATCH v2 3/7] RISC-V: " Jan Beulich
2026-08-27 15:56 ` Oleksii Kurochko
2026-08-27 16:01 ` Jan Beulich
2026-08-27 16:12 ` Oleksii Kurochko
2026-08-26 12:01 ` [PATCH v2 4/7] PPC: " Jan Beulich
2026-09-03 11:50 ` Anthony PERARD
2026-08-26 12:02 ` [PATCH v2 5/7] build: move $(all-symbols-*) Jan Beulich
2026-09-03 11:54 ` Anthony PERARD
2026-08-26 12:03 ` [PATCH v2 6/7] build: move $(compare-symbol-tables) Jan Beulich
2026-09-03 11:55 ` Anthony PERARD
2026-08-26 12:04 ` [PATCH v2 7/7] RISC-V: place .sdata / .srodata / .riscv.attributes Jan Beulich
2026-08-27 15:40 ` Oleksii Kurochko
2026-08-27 15:53 ` Andrew Cooper
2026-08-27 15:56 ` Jan Beulich
2026-08-27 16:07 ` Oleksii Kurochko
2026-09-01 7:52 ` Jan Beulich
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=4f99f95c-dadd-4f6e-b444-67f2eaa3fe47@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=teddy.astie@vates.tech \
--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.