From 3805e65ed3b7306329bf0305d5b46f08d7619a11 Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Sat, 29 Mar 2025 00:38:14 +0100 Subject: [PATCH] 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 --- tools/mpy_ld.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/mpy_ld.py b/tools/mpy_ld.py index 44a76bdee6..70cab2b894 100755 --- a/tools/mpy_ld.py +++ b/tools/mpy_ld.py @@ -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":