mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@barebox.org>, barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] ARM: cpu: common: define generic relocate_image
Date: Tue, 6 Jan 2026 12:43:15 +0100	[thread overview]
Message-ID: <234ea2b9-d45a-4751-ad9f-f8e95aa7103f@pengutronix.de> (raw)
In-Reply-To: <20260106081659.3491945-2-a.fatoum@barebox.org>

Hi,

On 1/6/26 9:16 AM, Ahmad Fatoum wrote:
> -	__memset(dynsym, 0, (unsigned long)dynend - (unsigned long)dynsym);
> +	/* Optional: not required for correctness */
> +	if (dynend)
> +		__memset(dynsym, 0, (unsigned long)dynend - (unsigned long)dynsym);

Unexpected revelation: We don't have any R_ARM_ABS32 relocations any
longer. Maybe because ARM32 is now always relocatable?

This will allow us to simplify some things.

Cheers,
Ahmad

>  #else
>  #error "Architecture not specified"
>  #endif
> +}
> +
> +void __prereloc relocate_to_current_adr(void)
> +{
> +	relocate_image(get_runtime_offset(),
> +		       runtime_address(__rel_dyn_start),
> +		       runtime_address(__rel_dyn_end),
> +		       runtime_address(__dynsym_start),
> +		       runtime_address(__dynsym_end));
>  
>  	sync_caches_for_execution();
>  }
> @@ -196,4 +193,3 @@ void print_pbl_mem_layout(ulong membase, ulong endmem, ulong barebox_base)
>  	printf("membase               = 0x%08lx+0x%08lx\n",
>  	       membase, endmem - membase);
>  }
> -
> diff --git a/arch/arm/include/asm/reloc.h b/arch/arm/include/asm/reloc.h
> index 2d7411ab5284..62c07932fad4 100644
> --- a/arch/arm/include/asm/reloc.h
> +++ b/arch/arm/include/asm/reloc.h
> @@ -30,6 +30,9 @@ static inline __prereloc unsigned long global_variable_offset(void)
>  }
>  #define global_variable_offset() global_variable_offset()
>  
> +void relocate_image(unsigned long offset,
> +		    void *dstart, void *dend,
> +		    long *dynsym, long *dynend);
>  void relocate_to_current_adr(void);
>  void relocate_to_adr(unsigned long target);
>  void relocate_to_adr_full(unsigned long target);

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




  parent reply	other threads:[~2026-01-06 11:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-06  8:16 [PATCH 1/2] ARM: cpu: common: skip R_ARM_NONE relocations Ahmad Fatoum
2026-01-06  8:16 ` [PATCH 2/2] ARM: cpu: common: define generic relocate_image Ahmad Fatoum
2026-01-06  9:16   ` Sascha Hauer
2026-01-06 11:43   ` Ahmad Fatoum [this message]
2026-01-06 13:18 ` [PATCH 1/2] ARM: cpu: common: skip R_ARM_NONE relocations Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=234ea2b9-d45a-4751-ad9f-f8e95aa7103f@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox