u-boot/arch
Pali Rohár 9167a1c28c powerpc: mpc85xx: Simplify jump to _start_cont in flash code
After more patches code for jumping to _start_cont symbol in flash memory
involved to code with useless mathematical operations. Currently it does:

  r3 := CONFIG_SYS_MONITOR_BASE + ABS(_start_cont) - CONFIG_SYS_MONITOR_BASE
  jump to r3

Which is equivalent of just:

  r3 := ABS(_start_cont)
  jump to r3

The purpose of that code is just to jump to _start_code symbol,
independently of program counter. So branch must be done to absolute
address. Trying to write:

  ba _start_cont

just cause linker error:

    LD      u-boot
  powerpc-linux-gnuspe-ld.bfd: arch/powerpc/cpu/mpc85xx/start.o: in function `switch_as':
  (.bootpg+0x4b8): relocation truncated to fit: R_PPC_ADDR24 against symbol `_start_cont' defined in .text section in arch/powerpc/cpu/mpc85xx/start.o
  make: *** [Makefile:1801: u-boot] Error 1

Probably by the fact that absolute address cannot be expressed by 24-bits.
So write the code via mtlr+blr pattern as it was before and load general
purpose register with absolute address of the symbol:

  lis     r3,_start_cont@h
  ori     r3,r3,_start_cont@l
  mtlr    r3
  blr

Seems that gcc and gnu ld linker support symbol@h and symbol@l syntax like
number@h and number@l without any problem. And disassembling of compiler
u-boot binary proved that lis+ori instructions are called with numbers
which represent halves of absolute address of _start_cont symbol.

Signed-off-by: Pali Rohár <pali@kernel.org>
2022-07-03 15:13:51 +08:00
..
arc linker_lists: Rename sections to remove . prefix 2022-06-23 12:58:18 -04:00
arm First set of u-boot-at91 features for the 2022.10 cycle 2022-06-30 15:21:52 -04:00
m68k Xilinx changes for v2022.10 2022-06-27 10:15:50 -04:00
microblaze Xilinx changes for v2022.10 2022-06-27 10:15:50 -04:00
mips Xilinx changes for v2022.10 2022-06-27 10:15:50 -04:00
nios2 linker_lists: Rename sections to remove . prefix 2022-06-23 12:58:18 -04:00
powerpc powerpc: mpc85xx: Simplify jump to _start_cont in flash code 2022-07-03 15:13:51 +08:00
riscv linker_lists: Rename sections to remove . prefix 2022-06-23 12:58:18 -04:00
sandbox sandbox: Implement fuzzing engine driver 2022-06-23 12:58:19 -04:00
sh linker_lists: Rename sections to remove . prefix 2022-06-23 12:58:18 -04:00
x86 tpl: Ensure all TPL symbols in Kconfig have some TPL dependency 2022-06-28 17:03:31 -04:00
xtensa xtensa: Switch to using CONFIG_XTENSA for building device trees 2022-06-28 17:03:31 -04:00
.gitignore
Kconfig Xilinx changes for v2022.10 2022-06-27 10:15:50 -04:00
u-boot-elf.lds