Skip to contentSkip to conversation

s390x: Fix build error messages

PATCH In review Nicholas Piggin 3 participants 6 messages Jun 2, 2024 – Jun 4, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover s390x: Fix build error messages

This fixes some non-fatal error messages during build. I have only tested TCG with no PV, so it's not intended for merge before that at least.

Thanks,
Nick

Nicholas Piggin (2):
s390x: Only run genprotimg if necessary
s390x: Specify program headers with flags to avoid linker warnings

 s390x/Makefile              |  4 ++++
 s390x/snippets/c/flat.lds.S | 12 +++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/2 s390x: Only run genprotimg if necessary

genprotimg is not required if the --host-key-document= configure option is not specified, so avoid running it in that case. This prevents the build message:

bash: line 1: genprotimg: command not found

---
 s390x/Makefile | 4 ++++
 1 file changed, 4 insertions(+)
s390x/Makefile +4 -0
index 19c41a2ec..c6518bbd1 100644
@@ -213,12 +213,16 @@ $(comm-key):
 
 # The genprotimg arguments for the cck changed over time so we need to
 # figure out which argument to use in order to set the cck
+ifneq ($(HOST_KEY_DOCUMENT),)
 GENPROTIMG_HAS_COMM_KEY = $(shell $(GENPROTIMG) --help | grep -q -- --comm-key && echo yes)
 ifeq ($(GENPROTIMG_HAS_COMM_KEY),yes)
 	GENPROTIMG_COMM_OPTION := --comm-key
 else
 	GENPROTIMG_COMM_OPTION := --x-comm-key
 endif
+else
+GENPROTIMG_HAS_COMM_KEY =
+endif
 
 ifeq ($(CONFIG_DUMP),yes)
 	# allow dumping + PCKMO
Signature · 1 line
2.43.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [kvm-unit-tests PATCH 1/2] s390x: Only run genprotimg if necessary

Quoted 7 lines · Nicholas Piggin

genprotimg is not required if the --host-key-document= configure option is not specified, so avoid running it in that case. This prevents the build message:

bash: line 1: genprotimg: command not found

This solves the immediate problem but I think we're really missing a lot more checks in the makefile and configure to sanitize the SE option space.

Anyway:

#3 lore raw

Re: [kvm-unit-tests PATCH 1/2] s390x: Only run genprotimg if necessary

Quoted 11 lines · Janosch Frank
Quoted 7 lines · Nicholas Piggin

genprotimg is not required if the --host-key-document= configure option is not specified, so avoid running it in that case. This prevents the build message:

bash: line 1: genprotimg: command not found

This solves the immediate problem but I think we're really missing a lot more checks in the makefile and configure to sanitize the SE option space.

Agree, it would be ideal to find genprotimg at configure time and warn or fail if other options were specified. That looked like a bigger job and I don't have a PV environment to test with at the moment.

Quoted 2 lines

Anyway:

Thanks,
Nick

#4 lore raw

PATCH 2/2 s390x: Specify program headers with flags to avoid linker warnings

In reply to Nicholas Piggin

Avoid "LOAD segment with RWX permissions" warnings from new linkers by specifying program headers. See 59a797f451cde and linked commits for similar fixes for other architectures.

---
 s390x/snippets/c/flat.lds.S | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
s390x/snippets/c/flat.lds.S +9 -3
index 468b5f1ee..6b8ceb9e0 100644
@@ -1,5 +1,11 @@
 #include <asm/asm-offsets.h>
 
+PHDRS
+{
+    text PT_LOAD FLAGS(5);
+    data PT_LOAD FLAGS(6);
+}
+
 SECTIONS
 {
 	.lowcore : {
@@ -29,7 +35,7 @@ SECTIONS
 		*(.init)
 		*(.text)
 		*(.text.*)
-	}
+	} :text
 	. = ALIGN(4K);
 	etext = .;
 	/* End text */
@@ -37,9 +43,9 @@ SECTIONS
 	.data : {
 		*(.data)
 		*(.data.rel*)
-	}
+	} :data
 	. = ALIGN(16);
-	.rodata : { *(.rodata) *(.rodata.*) }
+	.rodata : { *(.rodata) *(.rodata.*) } :data
 	. = ALIGN(16);
 	.bss : { *(.bss) }
 	/* End data */
Signature · 1 line
2.43.0
#5 lore raw
In reply to Nicholas Piggin
Quoted 10 lines · Nicholas Piggin

This fixes some non-fatal error messages during build. I have only tested TCG with no PV, so it's not intended for merge before that at least.

Thanks,
Nick

Nicholas Piggin (2):
s390x: Only run genprotimg if necessary
s390x: Specify program headers with flags to avoid linker warnings

Thanks, I reviewed and tested the patches, and all looks fine. Thus I went ahead and merged the two patches now.

Thomas