From: Marc Hartmayer <mhartmay@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>,
Claudio Imbrenda <imbrenda@linux.ibm.com>,
Nico Boehr <nrb@linux.ibm.com>, Thomas Huth <thuth@redhat.com>,
Eric Auger <eric.auger@redhat.com>
Cc: <kvm@vger.kernel.org>, <linux-s390@vger.kernel.org>
Subject: [kvm-unit-tests PATCH] (arm|powerpc|s390x): Makefile: add `%.aux.o` target
Date: Thu, 25 Jan 2024 16:11:27 +0100 [thread overview]
Message-ID: <20240125151127.94798-1-mhartmay@linux.ibm.com> (raw)
It's unusual to create multiple files in one target rule, therefore create an
extra target for `%.aux.o` and list it as prerequisite. As a side effect, this
change fixes the dependency tracking of the prerequisites of
`.aux.o` (`lib/auxinfo.c` was missing).
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
arm/Makefile.common | 23 ++++++++++++-----------
powerpc/Makefile.common | 10 +++++-----
s390x/Makefile | 9 +++++----
3 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/arm/Makefile.common b/arm/Makefile.common
index 5214c8acdab3..54cb4a63ab64 100644
--- a/arm/Makefile.common
+++ b/arm/Makefile.common
@@ -70,14 +70,14 @@ eabiobjs = lib/arm/eabi_compat.o
FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libeabi)
ifeq ($(CONFIG_EFI),y)
+%.aux.o: $(SRCDIR)/lib/auxinfo.c
+ $(CC) $(CFLAGS) -c -o $@ $^ \
+ -DPROGNAME=\"$(@:.aux.o=.efi)\" -DAUXFLAGS=$(AUXFLAGS)
+
%.so: EFI_LDFLAGS += -defsym=EFI_SUBSYSTEM=0xa --no-undefined
-%.so: %.o $(FLATLIBS) $(SRCDIR)/arm/efi/elf_aarch64_efi.lds $(cstart.o)
- $(CC) $(CFLAGS) -c -o $(@:.so=.aux.o) $(SRCDIR)/lib/auxinfo.c \
- -DPROGNAME=\"$(@:.so=.efi)\" -DAUXFLAGS=$(AUXFLAGS)
+%.so: %.o $(FLATLIBS) $(SRCDIR)/arm/efi/elf_aarch64_efi.lds $(cstart.o) %.aux.o
$(LD) $(EFI_LDFLAGS) -o $@ -T $(SRCDIR)/arm/efi/elf_aarch64_efi.lds \
- $(filter %.o, $^) $(FLATLIBS) $(@:.so=.aux.o) \
- $(EFI_LIBS)
- $(RM) $(@:.so=.aux.o)
+ $(filter %.o, $^) $(FLATLIBS) $(EFI_LIBS)
%.efi: %.so
$(call arch_elf_check, $^)
@@ -90,13 +90,14 @@ ifeq ($(CONFIG_EFI),y)
-j .reloc \
-O binary $^ $@
else
+%.aux.o: $(SRCDIR)/lib/auxinfo.c
+ $(CC) $(CFLAGS) -c -o $@ $^ \
+ -DPROGNAME=\"$(@:.aux.o=.flat)\" -DAUXFLAGS=$(AUXFLAGS)
+
%.elf: LDFLAGS += $(arch_LDFLAGS)
-%.elf: %.o $(FLATLIBS) $(SRCDIR)/arm/flat.lds $(cstart.o)
- $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(SRCDIR)/lib/auxinfo.c \
- -DPROGNAME=\"$(@:.elf=.flat)\" -DAUXFLAGS=$(AUXFLAGS)
+%.elf: %.o $(FLATLIBS) $(SRCDIR)/arm/flat.lds $(cstart.o) %.aux.o
$(LD) $(LDFLAGS) -o $@ -T $(SRCDIR)/arm/flat.lds \
- $(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o)
- $(RM) $(@:.elf=.aux.o)
+ $(filter %.o, $^) $(FLATLIBS)
@chmod a-x $@
%.flat: %.elf
diff --git a/powerpc/Makefile.common b/powerpc/Makefile.common
index f8f474908b06..483ff64829a7 100644
--- a/powerpc/Makefile.common
+++ b/powerpc/Makefile.common
@@ -47,16 +47,16 @@ cflatobjs += lib/powerpc/smp.o
OBJDIRS += lib/powerpc
+%.aux.o: $(SRCDIR)/lib/auxinfo.c
+ $(CC) $(CFLAGS) -c -o $@ $^ -DPROGNAME=\"$(@:.aux.o=.elf)\"
+
FLATLIBS = $(libcflat) $(LIBFDT_archive)
%.elf: CFLAGS += $(arch_CFLAGS)
%.elf: LDFLAGS += $(arch_LDFLAGS) -pie -n
-%.elf: %.o $(FLATLIBS) $(SRCDIR)/powerpc/flat.lds $(cstart.o) $(reloc.o)
- $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(SRCDIR)/lib/auxinfo.c \
- -DPROGNAME=\"$@\"
+%.elf: %.o $(FLATLIBS) $(SRCDIR)/powerpc/flat.lds $(cstart.o) $(reloc.o) %.aux.o
$(LD) $(LDFLAGS) -o $@ \
-T $(SRCDIR)/powerpc/flat.lds --build-id=none \
- $(filter %.o, $^) $(FLATLIBS) $(@:.elf=.aux.o)
- $(RM) $(@:.elf=.aux.o)
+ $(filter %.o, $^) $(FLATLIBS)
@chmod a-x $@
@echo -n Checking $@ for unsupported reloc types...
@if $(OBJDUMP) -R $@ | grep R_ | grep -v R_PPC64_RELATIVE; then \
diff --git a/s390x/Makefile b/s390x/Makefile
index f79fd0098312..e64521e002ce 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -176,13 +176,14 @@ lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@
%.lds: %.lds.S $(asm-offsets)
$(CPP) $(lds-autodepend-flags) $(CPPFLAGS) -P -C -o $@ $<
+%.aux.o: $(SRCDIR)/lib/auxinfo.c
+ $(CC) $(CFLAGS) -c -o $@ $^ -DPROGNAME=\"$(@:.aux.o=.elf)\"
+
.SECONDEXPANSION:
-%.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o
- $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(SRCDIR)/lib/auxinfo.c -DPROGNAME=\"$@\"
+%.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o %.aux.o
@$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds \
- $(filter %.o, $^) $(FLATLIBS) $(snippets-obj) $(snippet-hdr-obj) $(@:.elf=.aux.o) || \
+ $(filter %.o, $^) $(FLATLIBS) $(snippets-obj) $(snippet-hdr-obj) || \
{ echo "Failure probably caused by missing definition of gen-se-header executable"; exit 1; }
- $(RM) $(@:.elf=.aux.o)
@chmod a-x $@
# Secure Execution Customer Communication Key file
--
2.34.1
next reply other threads:[~2024-01-25 15:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 15:11 Marc Hartmayer [this message]
2024-01-25 15:30 ` [kvm-unit-tests PATCH] (arm|powerpc|s390x): Makefile: add `%.aux.o` target Marc Hartmayer
2024-02-01 12:09 ` Thomas Huth
2024-02-01 13:55 ` Andrew Jones
2024-02-01 14:16 ` Marc Hartmayer
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=20240125151127.94798-1-mhartmay@linux.ibm.com \
--to=mhartmay@linux.ibm.com \
--cc=eric.auger@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nrb@linux.ibm.com \
--cc=thuth@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox