File s390-tools-sles15sp2-01-zipl-libc-libc_stop-move-noreturn-to-declaration.patch of Package s390-tools.17983

Subject: [PATCH] [BZ 186940] zipl/libc: libc_stop move 'noreturn' to declaration
From: Stefan Haberland <sth@linux.ibm.com>

Description:   zipl: Fix KVM IPL without bootindex
Symptom:       Failed IPL on KVM when no bootindex is specified.
Problem:       Without bootindex specified there is no IPL parmblock
               on KVM which can be read by the stage3 loader.
Solution:      In case diag308 gives a response code 0x102 the stage3
               loader can safely assume that no secure IPL is required
               since no IPL report block exists.
Reproduction:  IPL on KVM without 'bootindex=' attached.
Upstream-ID:   c9066bf5497300db5e0ba11bf111683ea225d8c8
Problem-ID:    186940

Upstream-Description:

              zipl/libc: libc_stop move 'noreturn' to declaration

              Commit 86856f98dbe3 ("zipl: Make use of __noreturn macro") moved the
              'noreturn' attribute from declaration to definition. With this the
              compiler can no longer optimize when the function is called in a
              separate source file. Move the attribute back to the declaration

              Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
              Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>


Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
---
 zipl/boot/libc.c |    3 +--
 zipl/boot/libc.h |    4 +++-
 2 files changed, 4 insertions(+), 3 deletions(-)

--- a/zipl/boot/libc.c
+++ b/zipl/boot/libc.c
@@ -13,7 +13,6 @@
 
 #include <stdarg.h>
 
-#include "lib/zt_common.h"
 #include "boot/s390.h"
 
 #include "error.h"
@@ -501,7 +500,7 @@ void initialize(void)
 /*
  * Load disabled wait PSW with reason code in address field
  */
-void __noreturn libc_stop(unsigned long reason)
+void libc_stop(unsigned long reason)
 {
 	struct psw_t psw;
 
--- a/zipl/boot/libc.h
+++ b/zipl/boot/libc.h
@@ -15,6 +15,8 @@
 
 #define NULL ((void *) 0)
 
+#include "lib/zt_common.h"
+
 #define EPERM		 1	/* Operation not permitted */
 #define ENOENT		 2	/* No such file or directory */
 #define ESRCH		 3	/* No such process */
@@ -56,7 +58,7 @@ char *strcpy(char *, const char *);
 unsigned long get_zeroed_page(void);
 void free_page(unsigned long);
 void initialize(void);
-void libc_stop(unsigned long);
+void libc_stop(unsigned long) __noreturn;
 void start(void);
 void pgm_check_handler(void);
 void pgm_check_handler_fn(void);
openSUSE Build Service is sponsored by