tools/mpy_ld.py: Give better error for unsupported ARM absolute relocs.

This is a known limitation, so better to give a clear warning than a
catch-all AssertionError.  Happens for example when trying to use
soft-float on ARCH=armv6m

Also give more details on the assertion for unknown relocations, such that
one can see which symbol it affects etc, to aid in debugging.

References issue #14430.

Signed-off-by: Jon Nordby <jononor@gmail.com>
This commit is contained in:
Jon Nordby 2025-03-29 00:38:14 +01:00 committed by Damien George
parent 6bb586619d
commit 3805e65ed3

View file

@ -702,9 +702,13 @@ def do_relocation_text(env, text_addr, r):
elif env.arch.name == "EM_RISCV":
(addr, value) = process_riscv32_relocation(env, text_addr, r)
elif env.arch.name == "EM_ARM" and r_info_type == R_ARM_ABS32:
# happens for soft-float on armv6m
raise ValueError("Absolute relocations not supported on ARM")
else:
# Unknown/unsupported relocation
assert 0, r_info_type
assert 0, (r_info_type, s.name, s.entry, env.arch.name)
# Write relocation
if env.arch.name == "EM_RISCV":