From: Marc Hartmayer <mhartmay@linux.ibm.com>
To: <linux-s390@vger.kernel.org>, Thomas Huth <thuth@redhat.com>,
Nicholas Piggin <npiggin@gmail.com>
Cc: <kvm@vger.kernel.org>, Janosch Frank <frankja@linux.ibm.com>,
Nico Boehr <nrb@linux.ibm.com>,
Steffen Eiden <seiden@linux.ibm.com>
Subject: [kvm-unit-tests PATCH v1 1/3] s390x/Makefile: snippets: Add separate target for the ELF snippets
Date: Tue, 4 Jun 2024 13:59:30 +0200 [thread overview]
Message-ID: <20240604115932.86596-2-mhartmay@linux.ibm.com> (raw)
In-Reply-To: <20240604115932.86596-1-mhartmay@linux.ibm.com>
It's unusual to create multiple files in one target rule, and it's even more
unusual to create an ELF file with a `.gbin` file extension first, and then
overwrite it in the next step. It might even lead to errors as the input file
path is also used as the output file path - but this depends on the objcopy
implementation. Therefore, create an extra target for the ELF files and list it
as a prerequisite for the *.gbin targets.
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
s390x/Makefile | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/s390x/Makefile b/s390x/Makefile
index 23342bd64f44..784818b2883e 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -153,14 +153,18 @@ $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets)
$(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets)
$(CC) $(CFLAGS) -c -nostdlib -o $@ $<
-$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SNIPPET_DIR)/asm/flat.lds
+$(SNIPPET_DIR)/asm/%.elf: $(SNIPPET_DIR)/asm/%.o $(SNIPPET_DIR)/asm/flat.lds
$(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/asm/flat.lds $<
- $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@
+
+$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.elf
+ $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $< $@
truncate -s '%4096' $@
-$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SNIPPET_DIR)/c/flat.lds
+$(SNIPPET_DIR)/c/%.elf: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SNIPPET_DIR)/c/flat.lds
$(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/c/flat.lds $< $(snippet_lib) $(FLATLIBS)
- $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@
+
+$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.elf
+ $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $< $@
truncate -s '%4096' $@
%.hdr: %.gbin $(HOST_KEY_DOCUMENT)
--
2.34.1
next prev parent reply other threads:[~2024-06-04 11:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 11:59 [kvm-unit-tests PATCH v1 0/3] s390x: small Makefile improvements Marc Hartmayer
2024-06-04 11:59 ` Marc Hartmayer [this message]
2024-06-05 1:21 ` [kvm-unit-tests PATCH v1 1/3] s390x/Makefile: snippets: Add separate target for the ELF snippets Nicholas Piggin
2024-06-05 7:32 ` Marc Hartmayer
2024-07-26 10:01 ` Janosch Frank
2024-07-29 7:00 ` Janosch Frank
2024-07-29 7:41 ` Marc Hartmayer
2024-06-04 11:59 ` [kvm-unit-tests PATCH v1 2/3] s390x/Makefile: snippets: Avoid creation of .eh_frame and .eh_frame_hdr sections Marc Hartmayer
2024-06-04 11:59 ` [kvm-unit-tests PATCH v1 3/3] Revert "s390x: Specify program headers with flags to avoid linker warnings" Marc Hartmayer
2024-06-04 12:04 ` Marc Hartmayer
2024-06-05 1:30 ` [kvm-unit-tests PATCH v1 0/3] s390x: small Makefile improvements Nicholas Piggin
2024-06-05 8:03 ` Marc Hartmayer
2024-07-26 8:31 ` 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=20240604115932.86596-2-mhartmay@linux.ibm.com \
--to=mhartmay@linux.ibm.com \
--cc=frankja@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=npiggin@gmail.com \
--cc=nrb@linux.ibm.com \
--cc=seiden@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