s390/decompresser: fix misaligned symbol build error
Heiko Carstens
maintainerPATCH 1/1 s390/decompresser: fix misaligned symbol build error
Nathan Chancellor reported a kernel build error on Fedora 39:
$ clang --version | head -1 clang version 16.0.5 (Fedora 16.0.5-1.fc39)
$ s390x-linux-gnu-ld --version | head -1 GNU ld version 2.40-1.fc39
$ make -skj"$(nproc)" ARCH=s390 CC=clang CROSS_COMPILE=s390x-linux-gnu- olddefconfig all s390x-linux-gnu-ld: arch/s390/boot/startup.o(.text+0x5b4): misaligned symbol `_decompressor_end' (0x35b0f) for relocation R_390_PC32DBL make[3]: *** [.../arch/s390/boot/Makefile:78: arch/s390/boot/vmlinux] Error 1
It turned out that the problem with misaligned symbols on s390 was fixed with commit 80ddf5ce1c92 ("s390: always build relocatable kernel") for the kernel image, but did not take into account that the decompressor uses its own set of CFLAGS, which come without -fPIE.
Add the -fPIE flag also to the decompresser CFLAGS to fix this.
--- arch/s390/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/s390/Makefile +1 -0
@@ -27,6 +27,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbac KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding KBUILD_CFLAGS_DECOMPRESSOR += -fno-stack-protector +KBUILD_CFLAGS_DECOMPRESSOR += -fPIE KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member) KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))
Signature · 1 line
2.39.2
Quoted 12 lines · Heiko Carstens
Nathan Chancellor reported a kernel build error on Fedora 39:
$ clang --version | head -1 clang version 16.0.5 (Fedora 16.0.5-1.fc39)$ s390x-linux-gnu-ld --version | head -1 GNU ld version 2.40-1.fc39$ make -skj"$(nproc)" ARCH=s390 CC=clang CROSS_COMPILE=s390x-linux-gnu- olddefconfig all s390x-linux-gnu-ld: arch/s390/boot/startup.o(.text+0x5b4): misaligned symbol `_decompressor_end' (0x35b0f) for relocation R_390_PC32DBL make[3]: *** [.../arch/s390/boot/Makefile:78: arch/s390/boot/vmlinux] Error 1
Quoted 7 lines
It turned out that the problem with misaligned symbols on s390 was fixed with commit
80ddf5ce1c92("s390: always build relocatable kernel") for the kernel image, but did not take into account that the decompressor uses its own set of CFLAGS, which come without -fPIE.Add the -fPIE flag also to the decompresser CFLAGS to fix this.
I think this should also have:
I technically just forwarded the report and did a little extra testing.
Quoted 4 lines
Reported-by Nathan Chancellor <[email protected]>Suggested-by Ulrich Weigand <[email protected]>Signed-off-by Heiko Carstens <[email protected]>
Thanks for the quick patch, this fixes the error and I did a simple boot test in QEMU with the resulting kernel, which showed no issues.
Quoted 19 lines
--- arch/s390/Makefile | 1 + 1 file changed, 1 insertion(+)arch/s390/Makefile +1
-0@@ -27,6 +27,7 @@ KBUILD_CFLAGS_DECOMPRESSOR += -fno-delete-null-pointer-checks -msoft-float -mbac KBUILD_CFLAGS_DECOMPRESSOR += -fno-asynchronous-unwind-tables KBUILD_CFLAGS_DECOMPRESSOR += -ffreestanding KBUILD_CFLAGS_DECOMPRESSOR += -fno-stack-protector +KBUILD_CFLAGS_DECOMPRESSOR += -fPIE KBUILD_CFLAGS_DECOMPRESSOR += $(call cc-disable-warning, address-of-packed-member) KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO),-g) KBUILD_CFLAGS_DECOMPRESSOR += $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call cc-option, -gdwarf-4,))Signature · 1 line
2.39.2
Heiko Carstens
maintainerQuoted 21 lines · Nathan Chancellor
Quoted 12 lines · Heiko Carstens
Nathan Chancellor reported a kernel build error on Fedora 39:
$ clang --version | head -1 clang version 16.0.5 (Fedora 16.0.5-1.fc39)$ s390x-linux-gnu-ld --version | head -1 GNU ld version 2.40-1.fc39$ make -skj"$(nproc)" ARCH=s390 CC=clang CROSS_COMPILE=s390x-linux-gnu- olddefconfig all s390x-linux-gnu-ld: arch/s390/boot/startup.o(.text+0x5b4): misaligned symbol `_decompressor_end' (0x35b0f) for relocation R_390_PC32DBL make[3]: *** [.../arch/s390/boot/Makefile:78: arch/s390/boot/vmlinux] Error 1Quoted 7 lines
It turned out that the problem with misaligned symbols on s390 was fixed with commit
80ddf5ce1c92("s390: always build relocatable kernel") for the kernel image, but did not take into account that the decompressor uses its own set of CFLAGS, which come without -fPIE.Add the -fPIE flag also to the decompresser CFLAGS to fix this.
Quoted 6 lines
I think this should also have:
I technically just forwarded the report and did a little extra testing.
Ok, added.
Quoted 4 lines
Thanks for the quick patch, this fixes the error and I did a simple boot test in QEMU with the resulting kernel, which showed no issues.
Tested-by Nathan Chancellor <[email protected]>
And this as well. :) Thanks a lot!