* [kvm-unit-tests PATCH] (arm|powerpc|s390x): Makefile: add `%.aux.o` target
@ 2024-01-25 15:11 Marc Hartmayer
2024-01-25 15:30 ` Marc Hartmayer
2024-02-01 12:09 ` Thomas Huth
0 siblings, 2 replies; 5+ messages in thread
From: Marc Hartmayer @ 2024-01-25 15:11 UTC (permalink / raw)
To: Janosch Frank, Claudio Imbrenda, Nico Boehr, Thomas Huth, Eric Auger
Cc: kvm, linux-s390
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] (arm|powerpc|s390x): Makefile: add `%.aux.o` target
2024-01-25 15:11 [kvm-unit-tests PATCH] (arm|powerpc|s390x): Makefile: add `%.aux.o` target Marc Hartmayer
@ 2024-01-25 15:30 ` Marc Hartmayer
2024-02-01 12:09 ` Thomas Huth
1 sibling, 0 replies; 5+ messages in thread
From: Marc Hartmayer @ 2024-01-25 15:30 UTC (permalink / raw)
To: Janosch Frank, Claudio Imbrenda, Nico Boehr, Thomas Huth, Eric Auger
Cc: kvm, linux-s390
On Thu, Jan 25, 2024 at 04:11 PM +0100, Marc Hartmayer <mhartmay@linux.ibm.com> wrote:
> 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>
> ---
Note: I have only tested it for s390x, so please take a close look!
--
Kind regards / Beste Grüße
Marc Hartmayer
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] (arm|powerpc|s390x): Makefile: add `%.aux.o` target
2024-01-25 15:11 [kvm-unit-tests PATCH] (arm|powerpc|s390x): Makefile: add `%.aux.o` target Marc Hartmayer
2024-01-25 15:30 ` Marc Hartmayer
@ 2024-02-01 12:09 ` Thomas Huth
2024-02-01 13:55 ` Andrew Jones
2024-02-01 14:16 ` Marc Hartmayer
1 sibling, 2 replies; 5+ messages in thread
From: Thomas Huth @ 2024-02-01 12:09 UTC (permalink / raw)
To: Marc Hartmayer, Janosch Frank, Claudio Imbrenda, Nico Boehr, Eric Auger
Cc: kvm, linux-s390
On 25/01/2024 16.11, Marc Hartmayer wrote:
> 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(-)
Patch looks sane to me, so I went ahead and pushed it to the git repo. Thanks!
By the way, unrelated to your modifications, but while testing it, I noticed
that "make distclean" leaves some files behind for the s390x build:
./configure --arch=s390x --cross-prefix=s390x-linux-gnu-
make -j$(nproc)
make distclean
git status --ignored
On branch master
Your branch is up to date with 'origin/master'.
Ignored files:
(use "git add -f <file>..." to include in what will be committed)
.mvpg-snippet.d
.sie-dat.d
.spec_ex.d
lib/auxinfo.o
s390x/snippets/c/.cstart.d
s390x/snippets/c/.flat.d
... in case someone wants to have a look ...
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: [kvm-unit-tests PATCH] (arm|powerpc|s390x): Makefile: add `%.aux.o` target
2024-02-01 12:09 ` Thomas Huth
@ 2024-02-01 13:55 ` Andrew Jones
2024-02-01 14:16 ` Marc Hartmayer
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Jones @ 2024-02-01 13:55 UTC (permalink / raw)
To: Thomas Huth
Cc: Marc Hartmayer, Janosch Frank, Claudio Imbrenda, Nico Boehr,
Eric Auger, kvm, linux-s390
On Thu, Feb 01, 2024 at 01:09:10PM +0100, Thomas Huth wrote:
> On 25/01/2024 16.11, Marc Hartmayer wrote:
> > 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(-)
>
> Patch looks sane to me, so I went ahead and pushed it to the git repo. Thanks!
I'll update the riscv port to make the same changes before merging it.
Thanks,
drew
>
> By the way, unrelated to your modifications, but while testing it, I noticed
> that "make distclean" leaves some files behind for the s390x build:
>
> ./configure --arch=s390x --cross-prefix=s390x-linux-gnu-
> make -j$(nproc)
> make distclean
> git status --ignored
>
> On branch master
> Your branch is up to date with 'origin/master'.
>
> Ignored files:
> (use "git add -f <file>..." to include in what will be committed)
> .mvpg-snippet.d
> .sie-dat.d
> .spec_ex.d
> lib/auxinfo.o
> s390x/snippets/c/.cstart.d
> s390x/snippets/c/.flat.d
>
> ... in case someone wants to have a look ...
>
> Thomas
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [kvm-unit-tests PATCH] (arm|powerpc|s390x): Makefile: add `%.aux.o` target
2024-02-01 12:09 ` Thomas Huth
2024-02-01 13:55 ` Andrew Jones
@ 2024-02-01 14:16 ` Marc Hartmayer
1 sibling, 0 replies; 5+ messages in thread
From: Marc Hartmayer @ 2024-02-01 14:16 UTC (permalink / raw)
To: Thomas Huth, Janosch Frank, Claudio Imbrenda, Nico Boehr, Eric Auger
Cc: kvm, linux-s390
On Thu, Feb 01, 2024 at 01:09 PM +0100, Thomas Huth <thuth@redhat.com> wrote:
> On 25/01/2024 16.11, Marc Hartmayer wrote:
>> 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(-)
>
> Patch looks sane to me, so I went ahead and pushed it to the git repo.
> Thanks!
Thanks.
>
> By the way, unrelated to your modifications, but while testing it, I noticed
> that "make distclean" leaves some files behind for the s390x build:
>
> ./configure --arch=s390x --cross-prefix=s390x-linux-gnu-
> make -j$(nproc)
> make distclean
> git status --ignored
>
> On branch master
> Your branch is up to date with 'origin/master'.
>
> Ignored files:
> (use "git add -f <file>..." to include in what will be committed)
> .mvpg-snippet.d
> .sie-dat.d
> .spec_ex.d
> lib/auxinfo.o
At least, this file is related to this patch. Before it was always
deleted, now it’s only removed if the “Makefile semantics” enforce it.
[…snip]
--
Kind regards / Beste Grüße
Marc Hartmayer
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-02-01 14:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 15:11 [kvm-unit-tests PATCH] (arm|powerpc|s390x): Makefile: add `%.aux.o` target Marc Hartmayer
2024-01-25 15:30 ` Marc Hartmayer
2024-02-01 12:09 ` Thomas Huth
2024-02-01 13:55 ` Andrew Jones
2024-02-01 14:16 ` Marc Hartmayer
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.