From 99100b3f99ba250cb924e031cadd4b1200f9f6e4 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Fri, 8 Aug 2025 10:05:57 +0000 Subject: [PATCH] zipl/boot: Explicitly declare stage2.head as used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although stage2.head is not directly used in stage2, it is required by other stages. To ensure it is retained during link-time optimization (LTO), explicitly mark it as used. This improves code readability and prevents LTO from mistakenly removing it. Reviewed-by: Mikhail Zaslonko Reviewed-by: Stefan Haberland Signed-off-by: Marc Hartmayer Signed-off-by: Jan Höppner --- zipl/boot/eckd2dump_mv.c | 2 +- zipl/boot/eckd2dump_sv.c | 2 +- zipl/boot/fba2dump.c | 2 +- zipl/boot/stage2.c | 2 +- zipl/boot/tape2dump.c | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zipl/boot/eckd2dump_mv.c b/zipl/boot/eckd2dump_mv.c index 4b6a1012..758c9bab 100644 --- a/zipl/boot/eckd2dump_mv.c +++ b/zipl/boot/eckd2dump_mv.c @@ -22,7 +22,7 @@ /* * Magic number at start of dump record */ -const uint64_t __section(.stage2.head) magic = 0x584d554c54363402ULL; /* XMULT64, version 2 */ +const uint64_t __used __section(.stage2.head) magic = 0x584d554c54363402ULL; /* XMULT64, version 2 */ /* * Parameter format for ECKD MV dumper (13 bytes): diff --git a/zipl/boot/eckd2dump_sv.c b/zipl/boot/eckd2dump_sv.c index 5823cd95..2cad1818 100644 --- a/zipl/boot/eckd2dump_sv.c +++ b/zipl/boot/eckd2dump_sv.c @@ -21,7 +21,7 @@ /* * Magic number at start of dump record */ -const uint64_t __section(.stage2.head) magic = 0x5845434b44363402ULL; /* "XECKD64", version 2 */ +const uint64_t __used __section(.stage2.head) magic = 0x5845434b44363402ULL; /* "XECKD64", version 2 */ /* * Get device characteristics from zipl parameter block diff --git a/zipl/boot/fba2dump.c b/zipl/boot/fba2dump.c index e9a93d4a..4ded60d6 100644 --- a/zipl/boot/fba2dump.c +++ b/zipl/boot/fba2dump.c @@ -24,7 +24,7 @@ /* * Magic number at start of dump record */ -const uint64_t __section(.stage2.head) magic = 0x5844464241363401ULL; /* XDFBA64, version 1 */ +const uint64_t __used __section(.stage2.head) magic = 0x5844464241363401ULL; /* XDFBA64, version 1 */ /* * FBA dump device partition specification diff --git a/zipl/boot/stage2.c b/zipl/boot/stage2.c index 9431eb8f..6d6cd2fb 100644 --- a/zipl/boot/stage2.c +++ b/zipl/boot/stage2.c @@ -147,4 +147,4 @@ void panic_notify(unsigned long UNUSED(reason)) { } -const uint64_t __section(.stage2.head) stage2_head; +const uint64_t __used __section(.stage2.head) stage2_head; diff --git a/zipl/boot/tape2dump.c b/zipl/boot/tape2dump.c index 371646ee..28a3484f 100644 --- a/zipl/boot/tape2dump.c +++ b/zipl/boot/tape2dump.c @@ -38,10 +38,10 @@ struct tape_head { uint64_t ccw2; } __packed; -const struct tape_head __section(.stage2.head) tape_head = { - .psw = PSW_LOAD | STAGE2_ENTRY, /* Start code at 0x2018 */ - .ccw1 = 0x0700000060000001ULL, /* Rewind ccw */ - .ccw2 = 0x0200200020003000ULL, /* CCW to load dump tool to 0x2000 */ +const struct tape_head __used __section(.stage2.head) tape_head = { + .psw = PSW_LOAD | STAGE2_ENTRY, /* Start code at 0x2018 */ + .ccw1 = 0x0700000060000001ULL, /* Rewind ccw */ + .ccw2 = 0x0200200020003000ULL, /* CCW to load dump tool to 0x2000 */ }; /*