u-boot/arch
Andre Przywara 81e712a917 ARM: relocate: Fix Thumb code by using proper label type
The generic ARM relocate_code function was using its own function entry
point as a relocation base, and it was obtaining that address by using
the "adr" instruction on that entry point label.
However that label is not just an ordinary label, instead we explicitly
mark it as a function start address. Normally that doesn't change much
(other than for debugging), but when assembled in Thumb mode, newer
versions of the GNU assembler prepare everything for this address being
used as the argument to a "bx" call, so make sure bit 0 is set in there
to mark this function as Thumb code. Of course this doesn't end up very
well when we use this address for the ensuing memcpy operation.

To avoid this problem, and to solve it in a robust way, add an extra
label, which is not marked as a function entry, and use that for the adr
instruction. This lets all assemblers generate the right immediate offset
in the "adr" instruction.

This fixes in particular ARMv7-M ports when using GNU binutils v2.37 or
newer (commit d3e52e120b68 seems to trigger the change in behaviour).

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reported-by: Jesse Taube <mr.bossman075@gmail.com>
2022-07-26 17:53:43 -04:00
..
arc zynqmp: Run board_get_usable_ram_top() only on main U-Boot 2022-07-26 08:23:54 +02:00
arm ARM: relocate: Fix Thumb code by using proper label type 2022-07-26 17:53:43 -04:00
m68k zynqmp: Run board_get_usable_ram_top() only on main U-Boot 2022-07-26 08:23:54 +02:00
microblaze zynqmp: Run board_get_usable_ram_top() only on main U-Boot 2022-07-26 08:23:54 +02:00
mips
nios2
powerpc zynqmp: Run board_get_usable_ram_top() only on main U-Boot 2022-07-26 08:23:54 +02:00
riscv zynqmp: Run board_get_usable_ram_top() only on main U-Boot 2022-07-26 08:23:54 +02:00
sandbox watchdog: add pulse support to gpio watchdog driver 2022-07-21 08:09:06 +02:00
sh
x86 zynqmp: Run board_get_usable_ram_top() only on main U-Boot 2022-07-26 08:23:54 +02:00
xtensa
.gitignore
Kconfig
Kconfig.nxp
u-boot-elf.lds