Skip to content

Commit 8c031ba

Browse files
committed
parisc: Unbreak bootloader due to gcc-7 optimizations
gcc-7 optimizes the byte-wise accesses of get_unaligned_le32() into word-wise accesses if the 32-bit integer output_len is declared as external. This panics then the bootloader since we don't have the unaligned access fault trap handler installed during boot time. Avoid this optimization by declaring output_len as byte-aligned and thus unbreak the bootloader code. Additionally, compile the boot code optimized for size. Signed-off-by: Helge Deller <[email protected]>
1 parent af21b01 commit 8c031ba

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

arch/parisc/boot/compressed/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ targets += misc.o piggy.o sizes.h head.o real2.o firmware.o
1515
KBUILD_CFLAGS := -D__KERNEL__ -O2 -DBOOTLOADER
1616
KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
1717
KBUILD_CFLAGS += $(cflags-y) -fno-delete-null-pointer-checks
18-
KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs
18+
KBUILD_CFLAGS += -fno-PIE -mno-space-regs -mdisable-fpregs -Os
1919
ifndef CONFIG_64BIT
2020
KBUILD_CFLAGS += -mfast-indirect-calls
2121
endif

arch/parisc/boot/compressed/misc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
/* Symbols defined by linker scripts */
2525
extern char input_data[];
2626
extern int input_len;
27-
extern __le32 output_len; /* at unaligned address, little-endian */
27+
/* output_len is inserted by the linker possibly at an unaligned address */
28+
extern __le32 output_len __aligned(1);
2829
extern char _text, _end;
2930
extern char _bss, _ebss;
3031
extern char _startcode_end;

0 commit comments

Comments
 (0)