From: Richard Henderson <richard.henderson@linaro.org>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: trini@konsulko.com, casey.connolly@linaro.org,
u-boot@lists.u-boot-project.org
Subject: Re: [PATCH 2/2] arm64: Add RELR relocs
Date: Thu, 3 Dec 2026 14:14:32 -0800 [thread overview]
Message-ID: <02b7e4f4-e7aa-4b85-a8f6-aa168fc02533@linaro.org> (raw)
In-Reply-To: <CAC_iWj+TaD8pytZeUozox_ifzFKEyewW6o61tmJO2vPe=KF=og@mail.gmail.com>
On 11/26/26 12:51, Ilias Apalodimas wrote:
> On Thu, 26 Nov 2026 at 18:58, Ilias Apalodimas
> <ilias.apalodimas@linaro.org> wrote:
>>
>> Hi Richard,
>>
>> Thanks for taking the time!
>>
>> On Thu, 26 Nov 2026 at 18:35, Richard Henderson
>> <richard.henderson@linaro.org> wrote:
>>>
>>> On 11/24/26 23:41, Ilias Apalodimas wrote:
>>>> ifneq ($(CONFIG_XPL_BUILD),y)
>>>> -# Check that only R_ARM_RELATIVE relocations are generated.
>>>> +# Check that only R_ARM_RELATIVE relocations are generated
>>>> +# unless we compile with RELR
>>>> +ifneq ($(CONFIG_RELR),y)
>>>> INPUTS-y += checkarmreloc
>>>> +endif
>>>
>>> No, you should still run this. If there are non-relative relocs they
>>> won't be packed. You still want the build to fail if something goes wrong.
>>>
>>> Alternately, a different check that ensures *only* relr exists.
>>
>> Fair enough. Tbh I tried to preserve the logic but readelf -rW seemed
>> to produce unreadable output. At least not so readable as
>> '0000000e3c68 000000000403 R_AARCH64_RELATIV
>> ff531'.
>> OTOH I was lazy enough and I (wrongly?) assumed that this couldn't be
>> detected yet, so I mentioned it in the commit message.
>
> Replying to myself here, but looking at the output again we can parse
> that only RELA & RELR are emitted.
> I'll fix it in v2
Yep.
>>> With RELR, the above pie_fix_loop *will* be empty, not may be.
>>> So why are you compiling it in at all?
>>
>> Is it always absent? Maybe I read this wrong but packed structs that
>> might end up being misaligned will still end up in rela.dyn.
>
> So something (nasty) like the patch below
>
> --- a/board/emulation/qemu-arm/qemu-arm.c
> +++ b/board/emulation/qemu-arm/qemu-arm.c
> @@ -102,6 +102,12 @@ static struct mm_region qemu_arm64_mem_map[] = {
>
> struct mm_region *mem_map = qemu_arm64_mem_map;
> #endif
> +struct relr_test {
> + u8 dummy;
> + void *ptr;
> +} __packed;
> +
> +struct relr_test relr_test = { .dummy = 1, .ptr = qemu_arm64_mem_map };
>
> int board_late_init(void)
> {
> @@ -109,6 +115,7 @@ int board_late_init(void)
> * Make sure virtio bus is enumerated so that peripherals
> * on the virtio bus can be discovered by their drivers
> */
> + printf("relr_test.ptr %p\n", relr_test.ptr);
> virtio_init();
>
> produces both rela & relr for me.
>
> $~/work/u-boot-tpm>readelf -SW u-boot
> [...]
> [ 9] .rela.dyn RELA 000000000013f810 140810
> 000018 18 A 0 0 8
> [10] .relr.dyn RELR 000000000013f828 140828
> 000800 08 A 0 0 8
Granted.
OTOH, we're not attempting to handle generic third-party code, we're
handling stuff in u-boot. Which, without going too far out on a limb,
shouldn't have misaligned pointers. Thankfully, we get to catch any
such mistake at build-time and fix it.
r~
next prev parent reply other threads:[~2026-12-04 0:59 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 7:41 [PATCH 1/2] arm64: relocate: convert relocate_code to C Ilias Apalodimas
2026-11-25 7:41 ` [PATCH 2/2] arm64: Add RELR relocs Ilias Apalodimas
2026-11-25 17:20 ` Quentin Schulz
2026-11-26 12:48 ` Peter Robinson
2026-11-26 15:14 ` Ilias Apalodimas
2026-11-27 18:46 ` Tom Rini
2026-12-03 22:27 ` Ilias Apalodimas
2026-12-03 22:42 ` Tom Rini
2026-12-03 22:53 ` Ilias Apalodimas
2026-12-03 23:02 ` Tom Rini
2026-12-04 6:44 ` Ilias Apalodimas
2026-12-04 15:12 ` Tom Rini
2026-12-04 15:50 ` Ilias Apalodimas
2026-12-04 16:13 ` Ilias Apalodimas
2026-11-26 16:35 ` Richard Henderson
2026-11-26 16:58 ` Ilias Apalodimas
2026-11-26 20:51 ` Ilias Apalodimas
2026-12-03 22:14 ` Richard Henderson [this message]
2026-11-25 17:07 ` [PATCH 1/2] arm64: relocate: convert relocate_code to C Quentin Schulz
2026-11-25 17:08 ` Casey Connolly
2026-11-25 17:11 ` Ilias Apalodimas
2026-11-27 18:35 ` Tom Rini
2026-11-26 16:11 ` Richard Henderson
2026-11-26 16:18 ` Ilias Apalodimas
2026-11-26 17:03 ` Ilias Apalodimas
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=02b7e4f4-e7aa-4b85-a8f6-aa168fc02533@linaro.org \
--to=richard.henderson@linaro.org \
--cc=casey.connolly@linaro.org \
--cc=ilias.apalodimas@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.u-boot-project.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.