Skip to contentSkip to conversation

Some cleanup patches

PATCH Superseded Marc Hartmayer 3 participants 28 messages Jan 16, 2023 – Jan 18, 2023 KVM

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Some cleanup patches

This patch series should be applied on top of Janosch's patch series ([kvm-unit-tests PATCH v2 1/7] s390x: Cleanup flat.lds).

Marc Hartmayer (9):
.gitignore: ignore s390x/comm.key file s390x/Makefile: simplify %.hdr target rules s390x/Makefile: fix *.gbin target dependencies s390x/Makefile: refactor CPPFLAGS s390x/Makefile: remove unused include path
s390x: define a macro for the stack frame size
s390x: use C pre-processor for linker script generation
s390x: use STACK_FRAME_SIZE macro in linker scripts lib/linux/const.h: test for __ASSEMBLER__ as well

 .gitignore                                  |  2 ++
 lib/linux/const.h                           |  2 +-
 lib/s390x/asm-offsets.c                     |  1 +
 s390x/Makefile                              | 20 +++++++++++---------
 s390x/cstart64.S                            |  2 +-
 s390x/{flat.lds => flat.lds.S}              |  4 +++-
 s390x/snippets/asm/{flat.lds => flat.lds.S} |  0
 s390x/snippets/c/{flat.lds => flat.lds.S}   |  6 ++++--
 8 files changed, 23 insertions(+), 14 deletions(-)
 rename s390x/{flat.lds => flat.lds.S} (93%)
 rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/c/{flat.lds => flat.lds.S} (88%)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/9 .gitignore: ignore `s390x/comm.key` file

Ignore the Secure Execution Customer Communication Key file.

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
.gitignore +1 -0
index 33529b65a7e3..601822d67325 100644
@@ -28,5 +28,6 @@ cscope.*
 /s390x/*.bin
 /s390x/snippets/*/*.gbin
 /efi-tests/*
+/s390x/comm.key
 /s390x/snippets/*/*.hdr
 /s390x/snippets/*/*.*obj
Signature · 1 line
2.34.1
Reviewed-by on v1 1/9
#2 lore raw

Re: [kvm-unit-tests PATCH 1/9] .gitignore: ignore `s390x/comm.key` file

Quoted 1 line · Marc Hartmayer

Ignore the Secure Execution Customer Communication Key file.

#3 lore raw

PATCH 2/9 s390x/Makefile: simplify `%.hdr` target rules

In reply to Marc Hartmayer

Merge the two Makefile target rules $(SNIPPET_DIR)/asm/%.hdr and $(SNIPPET_DIR)/c/%.hdr into one target rule.

---
 s390x/Makefile | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
s390x/Makefile +1 -4
index 97a616111680..660ff06f1e7c 100644
@@ -145,10 +145,7 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS)
 	$(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)/asm/%.hdr: $(SNIPPET_DIR)/asm/%.gbin $(HOST_KEY_DOCUMENT)
-	$(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@
-
-$(SNIPPET_DIR)/c/%.hdr: $(SNIPPET_DIR)/c/%.gbin $(HOST_KEY_DOCUMENT)
+%.hdr: %.gbin $(HOST_KEY_DOCUMENT)
 	$(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@
 
 .SECONDARY:
Signature · 1 line
2.34.1
Reviewed-by on v1 2/9
#4 lore raw

Re: [kvm-unit-tests PATCH 2/9] s390x/Makefile: simplify `%.hdr` target rules

Quoted 2 lines · Marc Hartmayer

Merge the two Makefile target rules $(SNIPPET_DIR)/asm/%.hdr and $(SNIPPET_DIR)/c/%.hdr into one target rule.

Should have thought of that myself after adding the linker script for assembly snippets...

Quoted 22 lines
---
  s390x/Makefile | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
s390x/Makefile +1 -4
index 97a616111680..660ff06f1e7c 100644
@@ -145,10 +145,7 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS)
  	$(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)/asm/%.hdr: $(SNIPPET_DIR)/asm/%.gbin $(HOST_KEY_DOCUMENT)
-	$(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@
-
-$(SNIPPET_DIR)/c/%.hdr: $(SNIPPET_DIR)/c/%.gbin $(HOST_KEY_DOCUMENT)
+%.hdr: %.gbin $(HOST_KEY_DOCUMENT)
  	$(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@
 
  .SECONDARY:
#5 lore raw

PATCH 3/9 s390x/Makefile: fix `*.gbin` target dependencies

In reply to Marc Hartmayer

If the linker scripts change, then the .gbin binaries must be rebuilt.

---
 s390x/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
s390x/Makefile +2 -2
index 660ff06f1e7c..b6bf2ed99afd 100644
@@ -135,12 +135,12 @@ $(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/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SRCDIR)/s390x/snippets/asm/flat.lds
 	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/asm/flat.lds $<
 	$(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/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDIR)/s390x/snippets/c/flat.lds
 	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/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 $@ $@
 	truncate -s '%4096' $@
Signature · 1 line
2.34.1
#6 lore raw

Re: [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies

Quoted 3 lines · On Mon, 16 Jan 2023 18:57:51 +0100 Marc Hartmayer <[email protected]>…

If the linker scripts change, then the .gbin binaries must be rebuilt.

I think this should be merged into the previous patch

Quoted 23 lines
---
 s390x/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
s390x/Makefile +2 -2
index 660ff06f1e7c..b6bf2ed99afd 100644
@@ -135,12 +135,12 @@ $(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/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SRCDIR)/s390x/snippets/asm/flat.lds
 	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/asm/flat.lds $<
 	$(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/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDIR)/s390x/snippets/c/flat.lds
 	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/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 $@ $@
 	truncate -s '%4096' $@
#7 lore raw

Re: [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies

In reply to Marc Hartmayer
Quoted 12 lines · Marc Hartmayer

If the linker scripts change, then the .gbin binaries must be rebuilt.

---
  s390x/Makefile | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
s390x/Makefile +0 -0
index 660ff06f1e7c..b6bf2ed99afd 100644

s390x/Makefile $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) · line 138

Quoted 5 lines
s390x/Makefile +1 -1
@@ -135,12 +135,12 @@ $(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/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SRCDIR)/s390x/snippets/asm/flat.lds

Any reason why you didn't use the shorter:
$(SNIPPET_DIR)/asm/flat.lds ?

Quoted 9 lines
s390x/Makefile +1 -1
  	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/asm/flat.lds $<
  	$(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/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDIR)/s390x/snippets/c/flat.lds
  	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/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 $@ $@
  	truncate -s '%4096' $@
#8 lore raw

Re: [kvm-unit-tests PATCH 3/9] s390x/Makefile: fix `*.gbin` target dependencies

Quoted 16 lines · Janosch Frank
Quoted 15 lines · Marc Hartmayer

If the linker scripts change, then the .gbin binaries must be rebuilt.

---
  s390x/Makefile | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
s390x/Makefile +0 -0
index 660ff06f1e7c..b6bf2ed99afd 100644
@@ -135,12 +135,12 @@ $(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 $@ $<
 
Quoted 5 lines

s390x/Makefile $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) · line 138

Quoted 2 lines
s390x/Makefile +1 -1
-$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o
+$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SRCDIR)/s390x/snippets/asm/flat.lds

Any reason why you didn't use the shorter:
$(SNIPPET_DIR)/asm/flat.lds ?

No - it was just copied from the rule without thinking further :)

Quoted 12 lines
Quoted 11 lines
s390x/Makefile +1 -1
  	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/asm/flat.lds $<
  	$(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/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDIR)/s390x/snippets/c/flat.lds
  	$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/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 $@ $@
  	truncate -s '%4096' $@
Signature · 8 lines
Kind regards / Beste Grüße
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen 
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
#9 lore raw

PATCH 4/9 s390x/Makefile: refactor CPPFLAGS

In reply to Marc Hartmayer

This change makes it easier to reuse them.

---
 s390x/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
s390x/Makefile +4 -1
index b6bf2ed99afd..032524373593 100644
@@ -63,9 +63,12 @@ test_cases: $(tests)
 test_cases_binary: $(tests_binary)
 test_cases_pv: $(tests_pv_binary)
 
+INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x lib
+CPPFLAGS = $(addprefix -I,$(INCLUDE_PATHS))
+
 CFLAGS += -std=gnu99
 CFLAGS += -ffreestanding
-CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/s390x -I lib
+CFLAGS += $(CPPFLAGS)
 CFLAGS += -O2
 CFLAGS += -march=zEC12
 CFLAGS += -mbackchain
Signature · 1 line
2.34.1
#10 lore raw

PATCH 5/9 s390x/Makefile: remove unused include path

In reply to Marc Hartmayer

lib seems to be unused therefore let's remove it.

---
 s390x/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/Makefile +1 -1
index 032524373593..31f6db11213d 100644
@@ -63,7 +63,7 @@ test_cases: $(tests)
 test_cases_binary: $(tests_binary)
 test_cases_pv: $(tests_pv_binary)
 
-INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x lib
+INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x
 CPPFLAGS = $(addprefix -I,$(INCLUDE_PATHS))
 
 CFLAGS += -std=gnu99
Signature · 1 line
2.34.1
#11 lore raw

Re: [kvm-unit-tests PATCH 5/9] s390x/Makefile: remove unused include path

Quoted 3 lines · On Mon, 16 Jan 2023 18:57:53 +0100 Marc Hartmayer <[email protected]>…

lib seems to be unused therefore let's remove it.

this definitely needs to be merged into the previous patch

Quoted 17 lines
---
 s390x/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
s390x/Makefile +1 -1
index 032524373593..31f6db11213d 100644
@@ -63,7 +63,7 @@ test_cases: $(tests)
 test_cases_binary: $(tests_binary)
 test_cases_pv: $(tests_pv_binary)
 
-INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x lib
+INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x
 CPPFLAGS = $(addprefix -I,$(INCLUDE_PATHS))
 
 CFLAGS += -std=gnu99
#12 lore raw

PATCH 6/9 s390x: define a macro for the stack frame size

In reply to Marc Hartmayer

Define and use a macro for the stack frame size.

---
 lib/s390x/asm-offsets.c | 1 +
 s390x/cstart64.S        | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
lib/s390x/asm-offsets.c +1 -0
index f612f3277a95..188dd2e51181 100644
@@ -87,6 +87,7 @@ int main(void)
 	OFFSET(STACK_FRAME_INT_GRS0, stack_frame_int, grs0);
 	OFFSET(STACK_FRAME_INT_GRS1, stack_frame_int, grs1);
 	DEFINE(STACK_FRAME_INT_SIZE, sizeof(struct stack_frame_int));
+	DEFINE(STACK_FRAME_SIZE, sizeof(struct stack_frame));
 
 	return 0;
 }
s390x/cstart64.S +1 -1
index 6f83da2a6c0a..468ace3ea4df 100644
@@ -38,7 +38,7 @@ start:
 	/* setup stack */
 	larl	%r15, stackptr
 	/* Clear first stack frame */
-	xc      0(160,%r15), 0(%r15)
+	xc      0(STACK_FRAME_SIZE,%r15), 0(%r15)
 	/* setup initial PSW mask + control registers*/
 	larl	%r1, initial_psw
 	lpswe	0(%r1)
Signature · 1 line
2.34.1
#13 lore raw

Re: [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size

Quoted 1 line · Marc Hartmayer

Define and use a macro for the stack frame size.

There are two more instances in s390x/macros.S and there might be some in s390x/gs.c.

Quoted 12 lines
---
  lib/s390x/asm-offsets.c | 1 +
  s390x/cstart64.S        | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)
lib/s390x/asm-offsets.c +0 -0
index f612f3277a95..188dd2e51181 100644

lib/s390x/asm-offsets.c int main(void) · line 90

Quoted 4 lines
lib/s390x/asm-offsets.c +1 -0
@@ -87,6 +87,7 @@ int main(void)
  	OFFSET(STACK_FRAME_INT_GRS0, stack_frame_int, grs0);
  	OFFSET(STACK_FRAME_INT_GRS1, stack_frame_int, grs1);
  	DEFINE(STACK_FRAME_INT_SIZE, sizeof(struct stack_frame_int));
+	DEFINE(STACK_FRAME_SIZE, sizeof(struct stack_frame));

I'm wondering why we didn't do this when Pierre introduced the int stacks...

Quoted 16 lines
lib/s390x/asm-offsets.c +0 -0
  	return 0;
  }
s390x/cstart64.S +1 -1
index 6f83da2a6c0a..468ace3ea4df 100644
@@ -38,7 +38,7 @@ start:
  	/* setup stack */
  	larl	%r15, stackptr
  	/* Clear first stack frame */
-	xc      0(160,%r15), 0(%r15)
+	xc      0(STACK_FRAME_SIZE,%r15), 0(%r15)
  	/* setup initial PSW mask + control registers*/
  	larl	%r1, initial_psw
  	lpswe	0(%r1)
#14 lore raw

Re: [kvm-unit-tests PATCH 6/9] s390x: define a macro for the stack frame size

Quoted 5 lines · Janosch Frank
Quoted 1 line · Marc Hartmayer

Define and use a macro for the stack frame size.

There are two more instances in s390x/macros.S and there might be some in s390x/gs.c.

Thanks, will change them.

Quoted 37 lines
Quoted 13 lines
---
  lib/s390x/asm-offsets.c | 1 +
  s390x/cstart64.S        | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)
lib/s390x/asm-offsets.c +0 -0
index f612f3277a95..188dd2e51181 100644

lib/s390x/asm-offsets.c int main(void) · line 90

Quoted 4 lines
lib/s390x/asm-offsets.c +1 -0
@@ -87,6 +87,7 @@ int main(void)
  	OFFSET(STACK_FRAME_INT_GRS0, stack_frame_int, grs0);
  	OFFSET(STACK_FRAME_INT_GRS1, stack_frame_int, grs1);
  	DEFINE(STACK_FRAME_INT_SIZE, sizeof(struct stack_frame_int));
+	DEFINE(STACK_FRAME_SIZE, sizeof(struct stack_frame));

I'm wondering why we didn't do this when Pierre introduced the int stacks...

Quoted 16 lines
lib/s390x/asm-offsets.c +0 -0
  	return 0;
  }
s390x/cstart64.S +1 -1
index 6f83da2a6c0a..468ace3ea4df 100644
@@ -38,7 +38,7 @@ start:
  	/* setup stack */
  	larl	%r15, stackptr
  	/* Clear first stack frame */
-	xc      0(160,%r15), 0(%r15)
+	xc      0(STACK_FRAME_SIZE,%r15), 0(%r15)
  	/* setup initial PSW mask + control registers*/
  	larl	%r1, initial_psw
  	lpswe	0(%r1)
Signature · 8 lines
Kind regards / Beste Grüße
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen 
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
#15 lore raw

PATCH 7/9 s390x: use C pre-processor for linker script generation

In reply to Marc Hartmayer

Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts" *.lds.S.

---
 .gitignore                                  | 1 +
 s390x/Makefile                              | 6 ++++--
 s390x/{flat.lds => flat.lds.S}              | 0
 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0
 s390x/snippets/c/{flat.lds => flat.lds.S}   | 0
 5 files changed, 5 insertions(+), 2 deletions(-)
 rename s390x/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)
.gitignore +1 -0
index 601822d67325..29f352c5ceb6 100644
@@ -31,3 +31,4 @@ cscope.*
 /s390x/comm.key
 /s390x/snippets/*/*.hdr
 /s390x/snippets/*/*.*obj
+/s390x/**/*.lds
s390x/Makefile +4 -2
index 31f6db11213d..45493160cdf8 100644
@@ -76,7 +76,7 @@ CFLAGS += -fno-delete-null-pointer-checks
 LDFLAGS += -nostdlib -Wl,--build-id=none
 
 # We want to keep intermediate files
-.PRECIOUS: %.o
+.PRECIOUS: %.o %.lds
 
 asm-offsets = lib/$(ARCH)/asm-offsets.h
 include $(SRCDIR)/scripts/asm-offsets.mak
@@ -159,6 +159,8 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDI
 %.hdr.obj: %.hdr
 	$(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@
 
+%.lds: %.lds.S
+	$(CPP) $(autodepend-flags) $(CPPFLAGS) -P -C -o $@ $<
 
 .SECONDEXPANSION:
 %.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o
@@ -211,7 +213,7 @@ $(snippet_asmlib): $$(patsubst %.o,%.S,$$@) $(asm-offsets)
 
 
 arch_clean: asm_offsets_clean
-	$(RM) $(TEST_DIR)/*.{o,elf,bin} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key)
+	$(RM) $(TEST_DIR)/*.{o,elf,bin,lds} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr,lds} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key)
 
 generated-files = $(asm-offsets)
 $(tests:.elf=.o) $(asmlib) $(cflatobjs): $(generated-files)
s390x/flat.lds.S renamed from s390x/flat.lds +0 -0
similarity index 100%
rename from s390x/flat.lds
rename to s390x/flat.lds.S
s390x/snippets/asm/flat.lds.S renamed from s390x/snippets/asm/flat.lds +0 -0
similarity index 100%
rename from s390x/snippets/asm/flat.lds
rename to s390x/snippets/asm/flat.lds.S
s390x/snippets/c/flat.lds.S renamed from s390x/snippets/c/flat.lds +0 -0
similarity index 100%
rename from s390x/snippets/c/flat.lds
rename to s390x/snippets/c/flat.lds.S
Signature · 1 line
2.34.1
#16 lore raw

Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation

Quoted 2 lines · On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <[email protected]>…

Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts" *.lds.S.

please explain that the original .lds scripts are being renamed to .lds.S, and that the .lds are now generated.

Quoted 18 lines
---
 .gitignore                                  | 1 +
 s390x/Makefile                              | 6 ++++--
 s390x/{flat.lds => flat.lds.S}              | 0
 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0
 s390x/snippets/c/{flat.lds => flat.lds.S}   | 0
 5 files changed, 5 insertions(+), 2 deletions(-)
 rename s390x/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)
.gitignore +0 -0
index 601822d67325..29f352c5ceb6 100644

.gitignore cscope.* · line 34

Quoted 4 lines
.gitignore +1 -0
@@ -31,3 +31,4 @@ cscope.*
 /s390x/comm.key
 /s390x/snippets/*/*.hdr
 /s390x/snippets/*/*.*obj
+/s390x/**/*.lds

why ** ?

Quoted 43 lines
s390x/Makefile +4 -2
index 31f6db11213d..45493160cdf8 100644
@@ -76,7 +76,7 @@ CFLAGS += -fno-delete-null-pointer-checks
 LDFLAGS += -nostdlib -Wl,--build-id=none
 
 # We want to keep intermediate files
-.PRECIOUS: %.o
+.PRECIOUS: %.o %.lds
 
 asm-offsets = lib/$(ARCH)/asm-offsets.h
 include $(SRCDIR)/scripts/asm-offsets.mak
@@ -159,6 +159,8 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SRCDI
 %.hdr.obj: %.hdr
 	$(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@
 
+%.lds: %.lds.S
+	$(CPP) $(autodepend-flags) $(CPPFLAGS) -P -C -o $@ $<
 
 .SECONDEXPANSION:
 %.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o
@@ -211,7 +213,7 @@ $(snippet_asmlib): $$(patsubst %.o,%.S,$$@) $(asm-offsets)
 
 
 arch_clean: asm_offsets_clean
-	$(RM) $(TEST_DIR)/*.{o,elf,bin} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key)
+	$(RM) $(TEST_DIR)/*.{o,elf,bin,lds} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr,lds} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key)
 
 generated-files = $(asm-offsets)
 $(tests:.elf=.o) $(asmlib) $(cflatobjs): $(generated-files)
s390x/flat.lds.S renamed from s390x/flat.lds +0 -0
similarity index 100%
rename from s390x/flat.lds
rename to s390x/flat.lds.S
s390x/snippets/asm/flat.lds.S renamed from s390x/snippets/asm/flat.lds +0 -0
similarity index 100%
rename from s390x/snippets/asm/flat.lds
rename to s390x/snippets/asm/flat.lds.S
s390x/snippets/c/flat.lds.S renamed from s390x/snippets/c/flat.lds +0 -0
similarity index 100%
rename from s390x/snippets/c/flat.lds
rename to s390x/snippets/c/flat.lds.S
#17 lore raw

Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation

Quoted 8 lines · Claudio Imbrenda
Quoted 2 lines · On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <[email protected]>…

Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts" *.lds.S.

please explain that the original .lds scripts are being renamed to .lds.S, and that the .lds are now generated.

Okay.

Quoted 14 lines
Quoted 14 lines
---
 .gitignore                                  | 1 +
 s390x/Makefile                              | 6 ++++--
 s390x/{flat.lds => flat.lds.S}              | 0
 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0
 s390x/snippets/c/{flat.lds => flat.lds.S}   | 0
 5 files changed, 5 insertions(+), 2 deletions(-)
 rename s390x/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)
Quoted 11 lines

.gitignore cscope.* · line 34

Quoted 9 lines
.gitignore +1 -0
index 601822d67325..29f352c5ceb6 100644
@@ -31,3 +31,4 @@ cscope.*
 /s390x/comm.key
 /s390x/snippets/*/*.hdr
 /s390x/snippets/*/*.*obj
+/s390x/**/*.lds

why ** ?

Because all of our linker scripts are generated now:

s390x/snippets/(c|asm)/*.lds

and

s390x/*.lds

[…snip]

Signature · 8 lines
Kind regards / Beste Grüße
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen 
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
#18 lore raw

Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation

Quoted 41 lines · On Tue, 17 Jan 2023 10:43:01 +0100 Marc Hartmayer <[email protected]>…
Quoted 8 lines · Claudio Imbrenda
Quoted 2 lines · On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <[email protected]>…

Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts" *.lds.S.

please explain that the original .lds scripts are being renamed to .lds.S, and that the .lds are now generated.

Okay.

Quoted 14 lines
Quoted 14 lines
---
 .gitignore                                  | 1 +
 s390x/Makefile                              | 6 ++++--
 s390x/{flat.lds => flat.lds.S}              | 0
 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0
 s390x/snippets/c/{flat.lds => flat.lds.S}   | 0
 5 files changed, 5 insertions(+), 2 deletions(-)
 rename s390x/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)
Quoted 11 lines

.gitignore cscope.* · line 34

Quoted 9 lines
.gitignore +1 -0
index 601822d67325..29f352c5ceb6 100644
@@ -31,3 +31,4 @@ cscope.*
 /s390x/comm.key
 /s390x/snippets/*/*.hdr
 /s390x/snippets/*/*.*obj
+/s390x/**/*.lds  

why ** ?

Because all of our linker scripts are generated now:

Quoted 8 lines

s390x/snippets/(c|asm)/*.lds

and

s390x/*.lds

[…snip]

I still don't understand why ** instead of just * ?

#19 lore raw

Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation

Quoted 46 lines · Claudio Imbrenda
Quoted 43 lines · On Tue, 17 Jan 2023 10:43:01 +0100 Marc Hartmayer <[email protected]>…
Quoted 8 lines · Claudio Imbrenda
Quoted 2 lines · On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <[email protected]>…

Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts" *.lds.S.

please explain that the original .lds scripts are being renamed to .lds.S, and that the .lds are now generated.

Okay.

Quoted 14 lines
Quoted 14 lines
---
 .gitignore                                  | 1 +
 s390x/Makefile                              | 6 ++++--
 s390x/{flat.lds => flat.lds.S}              | 0
 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0
 s390x/snippets/c/{flat.lds => flat.lds.S}   | 0
 5 files changed, 5 insertions(+), 2 deletions(-)
 rename s390x/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)
Quoted 11 lines

.gitignore cscope.* · line 34

Quoted 9 lines
.gitignore +1 -0
index 601822d67325..29f352c5ceb6 100644
@@ -31,3 +31,4 @@ cscope.*
 /s390x/comm.key
 /s390x/snippets/*/*.hdr
 /s390x/snippets/*/*.*obj
+/s390x/**/*.lds  

why ** ?

Because all of our linker scripts are generated now:

s390x/snippets/(c|asm)/*.lds

Quoted 8 lines
Quoted 6 lines

and

s390x/*.lds

[…snip]

I still don't understand why ** instead of just * ?

“A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.” [1]

[1] https://git-scm.com/docs/gitignore

Signature · 8 lines
Kind regards / Beste Grüße
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen 
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
#20 lore raw

Re: [kvm-unit-tests PATCH 7/9] s390x: use C pre-processor for linker script generation

In reply to Marc Hartmayer
Quoted 41 lines · On Tue, 17 Jan 2023 10:43:01 +0100 Marc Hartmayer <[email protected]>…
Quoted 8 lines · Claudio Imbrenda
Quoted 2 lines · On Mon, 16 Jan 2023 18:57:55 +0100 Marc Hartmayer <[email protected]>…

Use the C pre-processor for the linker script generation. For example, this enables us the use of constants in the "linker scripts" *.lds.S.

please explain that the original .lds scripts are being renamed to .lds.S, and that the .lds are now generated.

Okay.

Quoted 14 lines
Quoted 14 lines
---
 .gitignore                                  | 1 +
 s390x/Makefile                              | 6 ++++--
 s390x/{flat.lds => flat.lds.S}              | 0
 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0
 s390x/snippets/c/{flat.lds => flat.lds.S}   | 0
 5 files changed, 5 insertions(+), 2 deletions(-)
 rename s390x/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%)
 rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%)
Quoted 11 lines

.gitignore cscope.* · line 34

Quoted 9 lines
.gitignore +1 -0
index 601822d67325..29f352c5ceb6 100644
@@ -31,3 +31,4 @@ cscope.*
 /s390x/comm.key
 /s390x/snippets/*/*.hdr
 /s390x/snippets/*/*.*obj
+/s390x/**/*.lds  

why ** ?

Because all of our linker scripts are generated now:

Quoted 8 lines

s390x/snippets/(c|asm)/*.lds

and

s390x/*.lds

[…snip]

ok so I thought ** was a typo and you meant either * or */*, but it turns out ** is actual a special glob syntax in gitignore

ignore my comments regarding ** :)

#21 lore raw

PATCH 8/9 s390x: use STACK_FRAME_SIZE macro in linker scripts

In reply to Marc Hartmayer

Use the STACK_FRAME_SIZE macro instead of a hard-coded value of 160.

---
 s390x/flat.lds.S            | 4 +++-
 s390x/snippets/c/flat.lds.S | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
s390x/flat.lds.S +3 -1
index 952f6cd457ed..0cb7e383cc76 100644
@@ -1,3 +1,5 @@
+#include <asm/asm-offsets.h>
+
 SECTIONS
 {
 	.lowcore : {
@@ -44,6 +46,6 @@ SECTIONS
 	/*
 	 * stackptr set with initial stack frame preallocated
 	 */
-	stackptr = . - 160;
+	stackptr = . - STACK_FRAME_SIZE;
 	stacktop = .;
 }
s390x/snippets/c/flat.lds.S +4 -2
index 9e5eb66bec23..468b5f1eebe8 100644
@@ -1,3 +1,5 @@
+#include <asm/asm-offsets.h>
+
 SECTIONS
 {
 	.lowcore : {
@@ -18,9 +20,9 @@ SECTIONS
 	. = 0x4000;
 	/*
 	 * The stack grows down from 0x4000 to 0x2000, we pre-allocoate
-	 * a frame via the -160.
+	 * a frame via the -STACK_FRAME_SIZE.
 	 */
-	stackptr = . - 160;
+	stackptr = . - STACK_FRAME_SIZE;
 	stacktop = .;
 	/* Start text 0x4000 */
 	.text : {
Signature · 1 line
2.34.1
#22 lore raw

Re: [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts

Quoted 3 lines · On Mon, 16 Jan 2023 18:57:56 +0100 Marc Hartmayer <[email protected]>…

Use the STACK_FRAME_SIZE macro instead of a hard-coded value of 160.

merge patch 6 into this one

Quoted 45 lines
---
 s390x/flat.lds.S            | 4 +++-
 s390x/snippets/c/flat.lds.S | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
s390x/flat.lds.S +3 -1
index 952f6cd457ed..0cb7e383cc76 100644
@@ -1,3 +1,5 @@
+#include <asm/asm-offsets.h>
+
 SECTIONS
 {
 	.lowcore : {
@@ -44,6 +46,6 @@ SECTIONS
 	/*
 	 * stackptr set with initial stack frame preallocated
 	 */
-	stackptr = . - 160;
+	stackptr = . - STACK_FRAME_SIZE;
 	stacktop = .;
 }
s390x/snippets/c/flat.lds.S +4 -2
index 9e5eb66bec23..468b5f1eebe8 100644
@@ -1,3 +1,5 @@
+#include <asm/asm-offsets.h>
+
 SECTIONS
 {
 	.lowcore : {
@@ -18,9 +20,9 @@ SECTIONS
 	. = 0x4000;
 	/*
 	 * The stack grows down from 0x4000 to 0x2000, we pre-allocoate
-	 * a frame via the -160.
+	 * a frame via the -STACK_FRAME_SIZE.
 	 */
-	stackptr = . - 160;
+	stackptr = . - STACK_FRAME_SIZE;
 	stacktop = .;
 	/* Start text 0x4000 */
 	.text : {
#23 lore raw

Re: [kvm-unit-tests PATCH 8/9] s390x: use STACK_FRAME_SIZE macro in linker scripts

In reply to Marc Hartmayer
Quoted 19 lines · Marc Hartmayer

Use the STACK_FRAME_SIZE macro instead of a hard-coded value of 160.

---
 s390x/flat.lds.S            | 4 +++-
 s390x/snippets/c/flat.lds.S | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
s390x/flat.lds.S +2 -0
index 952f6cd457ed..0cb7e383cc76 100644
@@ -1,3 +1,5 @@
+#include <asm/asm-offsets.h>
+
 SECTIONS
 {
 	.lowcore : {

s390x/flat.lds.S SECTIONS · line 49

Quoted 5 lines
s390x/flat.lds.S +1 -1
@@ -44,6 +46,6 @@ SECTIONS
 	/*
 	 * stackptr set with initial stack frame preallocated
 	 */
-	stackptr = . - 160;
+	stackptr = . - STACK_FRAME_SIZE;

One small fix: After this change the ‘$(asm-offsets)‘ dependency has to be added to to %.lds target rule in the Makefile.

[…snip]

Signature · 8 lines
Kind regards / Beste Grüße
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen 
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
#24 lore raw

PATCH 9/9 lib/linux/const.h: test for `__ASSEMBLER__` as well

In reply to Marc Hartmayer

The macro __ASSEMBLER__ is defined with value 1 when preprocessing assembly language using gcc. [1] For s390x, we're using the preprocessor for generating our linker scripts out of assembly file and therefore we need this change.

[1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

---
 lib/linux/const.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/linux/const.h +1 -1
index c872bfd25e13..be114dc4a553 100644
@@ -12,7 +12,7 @@
  * leave it unchanged in asm.
  */
 
-#ifdef __ASSEMBLY__
+#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
 #define _AC(X,Y)	X
 #define _AT(T,X)	X
 #else
Signature · 1 line
2.34.1
#25 lore raw

Re: [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well

Quoted 8 lines · On Mon, 16 Jan 2023 18:57:57 +0100 Marc Hartmayer <[email protected]>…

The macro __ASSEMBLER__ is defined with value 1 when preprocessing assembly language using gcc. [1] For s390x, we're using the preprocessor for generating our linker scripts out of assembly file and therefore we need this change.

[1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

is this patch really needed? if so, why is it at the end of the series?

Quoted 17 lines
---
 lib/linux/const.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/linux/const.h +1 -1
index c872bfd25e13..be114dc4a553 100644
@@ -12,7 +12,7 @@
  * leave it unchanged in asm.
  */
 
-#ifdef __ASSEMBLY__
+#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
 #define _AC(X,Y)	X
 #define _AT(T,X)	X
 #else
#26 lore raw

Re: [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well

Quoted 8 lines · Claudio Imbrenda
Quoted 5 lines · On Mon, 16 Jan 2023 18:57:57 +0100 Marc Hartmayer <[email protected]>…

The macro __ASSEMBLER__ is defined with value 1 when preprocessing assembly language using gcc. [1] For s390x, we're using the preprocessor for generating our linker scripts out of assembly file and therefore we need this change.

Quoted 6 lines
Quoted 3 lines

[1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

is this patch really needed? if so, why is it at the end of the series?

It was needed for some other patches… and for upcoming patches it is (probably) required since otherwise we cannot use macros using the _AC macro. So yep, it could be removed for now - and this was exactly the reason why I put it at the end of the series.

Thanks for the feedback!

Quoted 19 lines
Quoted 18 lines
---
 lib/linux/const.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/linux/const.h +1 -1
index c872bfd25e13..be114dc4a553 100644
@@ -12,7 +12,7 @@
  * leave it unchanged in asm.
  */
 
-#ifdef __ASSEMBLY__
+#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
 #define _AC(X,Y)	X
 #define _AT(T,X)	X
 #else
Signature · 8 lines
Kind regards / Beste Grüße
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen 
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
#27 lore raw

Re: [kvm-unit-tests PATCH 9/9] lib/linux/const.h: test for `__ASSEMBLER__` as well

Quoted 17 lines · On Tue, 17 Jan 2023 10:39:58 +0100 Marc Hartmayer <[email protected]>…
Quoted 8 lines · Claudio Imbrenda
Quoted 5 lines · On Mon, 16 Jan 2023 18:57:57 +0100 Marc Hartmayer <[email protected]>…

The macro __ASSEMBLER__ is defined with value 1 when preprocessing assembly language using gcc. [1] For s390x, we're using the preprocessor for generating our linker scripts out of assembly file and therefore we need this change.

Quoted 6 lines
Quoted 3 lines

[1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html

is this patch really needed? if so, why is it at the end of the series?

Quoted 6 lines

It was needed for some other patches… and for upcoming patches it is (probably) required since otherwise we cannot use macros using the _AC macro. So yep, it could be removed for now - and this was exactly the reason why I put it at the end of the series.

Thanks for the feedback!

I don't see a problem adding this even if it's not used right now, but in that case I want to know why you want to add it now :)

Just explain clearly in the patch description that this will be useful in the future and why :)

Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
 
---
 lib/linux/const.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/linux/const.h +1 -1
index c872bfd25e13..be114dc4a553 100644
@@ -12,7 +12,7 @@
  * leave it unchanged in asm.
  */
 
-#ifdef __ASSEMBLY__
+#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__)
 #define _AC(X,Y)	X
 #define _AT(T,X)	X
 #else