zipl: Fix -Wstringop-overread warning in IMPORT_DATA macro

Declare binary data symbols as arrays to correctly represent
linker-provided symbols of unknown size. This resolves compiler warnings
about reading 22-24 bytes from a 1-byte region when including stage*
loaders.

DEBUG: In function ‘memcpy’,
DEBUG:     inlined from ‘boot_init_eckd_ldl_stage0’ at boot.c:181:2,
DEBUG:     inlined from ‘install_svdump_eckd_ldl’ at install.c:891:2,
DEBUG:     inlined from ‘install_dump’ at install.c:1221:9,
DEBUG:     inlined from ‘main’ at zipl.c:185:9:
DEBUG: /usr/include/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ reading 22 bytes from a region of size 1 [-Wstringop-overread]
DEBUG:    29 |   return __builtin___memcpy_chk (__dest, __src, __len,
DEBUG:       |          ^

Signed-off-by: Marc Hartmayer <marc@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2026-07-06 11:10:28 +02:00
committed by Jan Höppner
parent 1f68c1aaf3
commit 33c75584cd

View File

@@ -30,12 +30,12 @@
/* Import a binary file */
/* clang-format off */
#define DATA_NAME(SYM, SUFFIX) _binary_##SYM##_bin##SUFFIX
#define DATA_SIZE(SYM) ((size_t)(&DATA_NAME(SYM, _end) - &DATA_NAME(SYM, _start)))
#define DATA_SIZE(SYM) ((size_t)(DATA_NAME(SYM, _end) - DATA_NAME(SYM, _start)))
#define DATA_ADDR(SYM) (&DATA_NAME(SYM, _start))
#define BIN_FILE_PATH(FILE_NAME) STRINGIFY(BUILD_PATH) "/" STRINGIFY(FILE_NAME) ".bin"
#define IMPORT_DATA(SYM) \
extern const uint8_t DATA_NAME(SYM, _start); \
extern const uint8_t DATA_NAME(SYM, _end); \
extern const uint8_t DATA_NAME(SYM, _start)[]; \
extern const uint8_t DATA_NAME(SYM, _end)[]; \
asm(".section \".rodata\", \"a\", @progbits\n" \
".balign 4\n" \
".global " STRINGIFY(DATA_NAME(SYM, _start)) "\n" \