Skip to content

Commit d617b33

Browse files
Andreas Bießmannhegtvedt-te
authored andcommitted
avr32: fix out-of-range jump in large kernels
This patch fixes following error (for big kernels): ---8<--- arch/avr32/boot/u-boot/head.o: In function `no_tag_table': (.init.text+0x44): relocation truncated to fit: R_AVR32_22H_PCREL against symbol `panic' defined in .text.unlikely section in kernel/built-in.o arch/avr32/kernel/built-in.o: In function `bad_return': (.ex.text+0x236): relocation truncated to fit: R_AVR32_22H_PCREL against symbol `panic' defined in .text.unlikely section in kernel/built-in.o --->8--- It comes up when the kernel increases and 'panic()' is too far away to fit in the +/- 2MiB range. Which in turn issues from the 21-bit displacement in 'br{cond4}' mnemonic which is one of the two ways to do jumps (rjmp has just 10-bit displacement and therefore a way smaller range). This fact was stated before in 8d29b7b. One solution to solve this is to add a local storage for the symbol address and just load the $pc with that value. Signed-off-by: Andreas Bießmann <andreas@biessmann.de> Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no> Cc: Haavard Skinnemoen <hskinnemoen@gmail.com> Cc: stable@vger.kernel.org
1 parent 7a2a74f commit d617b33

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎arch/avr32/boot/u-boot/head.S‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ init_sr:
7373
.long 0x007f0000 /* Supervisor mode, everything masked */
7474
stack_addr:
7575
.long init_thread_union
76+
panic_addr:
77+
.long panic
7678

7779
no_tag_table:
7880
sub r12, pc, (. - 2f)
79-
bral panic
81+
/* branch to panic() which can be far away with that construct */
82+
lddpc pc, panic_addr
8083
2: .asciz "Boot loader didn't provide correct magic number\n"

‎arch/avr32/kernel/entry-avr32b.S‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,10 @@ handle_critical:
401401
/* We should never get here... */
402402
bad_return:
403403
sub r12, pc, (. - 1f)
404-
bral panic
404+
lddpc pc, 2f
405405
.align 2
406406
1: .asciz "Return from critical exception!"
407+
2: .long panic
407408

408409
.align 1
409410
do_bus_error_write:

0 commit comments

Comments
 (0)