[PATCH v1] arm: relocate: Replace ADR instruction with non-pseudo-instruction

Tom Rini trini at konsulko.com
Mon Jul 11 14:11:53 CEST 2022


On Sun, Jul 10, 2022 at 03:09:53AM -0400, Jesse Taube wrote:

> In Binutils 2.37 the ADR instruction has changed
> use alternate instructions.
> 
> The change causes armv7-m to not boot.
> 
> Signed-off-by: Jesse Taube <Mr.Bossman075 at gmail.com>
> ---
>  arch/arm/lib/relocate.S | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S
> index 14b7f61c1a..22c419534f 100644
> --- a/arch/arm/lib/relocate.S
> +++ b/arch/arm/lib/relocate.S
> @@ -78,7 +78,13 @@ ENDPROC(relocate_vectors)
>   */
>  
>  ENTRY(relocate_code)
> -	adr	r3, relocate_code
> +/*
> + * Binutils doesn't comply with the arm docs for adr in thumb2
> + * from commit d3e52e120b68bf19552743fbc078e0a759f48cb7 onward
> + * to remove ambiguity explicitly define the pseudo-instruction
> + */
> +	mov r3, pc
> +	subs r3, #4
>  	ldr	r1, _image_copy_start_ofs
>  	add	r1, r3			/* r1 <- Run &__image_copy_start */
>  	subs	r4, r0, r1		/* r4 <- Run to copy offset      */

Thanks for posting this.  I'm hoping that perhaps one of our Arm folks
can review this.  Aside from whitespace (which can be fixed up easily),
this looks good and it's good to have a comment explaining why.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20220711/fe65ac39/attachment.sig>


More information about the U-Boot mailing list