Skip to content

Commit 718ff4f

Browse files
committed
tools/mpy_ld.py: Support R_ARM_ABS32 relocation in text.
Add support for R_ARM_ABS32 relocations in native .mpy files. These can be rewritten in the same way that data relocations are. Fixes issue micropython#14430. Signed-off-by: Damien George <[email protected]>
1 parent 5f4abeb commit 718ff4f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/mpy_ld.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,9 @@ def do_relocation_text(env, text_addr, r):
711711
(addr, value) = process_riscv32_relocation(env, text_addr, r)
712712

713713
elif env.arch.name == "EM_ARM" and r_info_type == R_ARM_ABS32:
714-
# happens for soft-float on armv6m
715-
raise ValueError("Absolute relocations not supported on ARM")
714+
# Absolute relocation, handled as a data relocation.
715+
do_relocation_data(env, text_addr, r)
716+
return
716717

717718
else:
718719
# Unknown/unsupported relocation
@@ -781,9 +782,9 @@ def do_relocation_data(env, text_addr, r):
781782
):
782783
# Relocation in data.rel.ro to internal/external symbol
783784
if env.arch.word_size == 4:
784-
struct_type = "<I"
785+
struct_type = "<i"
785786
elif env.arch.word_size == 8:
786-
struct_type = "<Q"
787+
struct_type = "<q"
787788
if hasattr(s, "resolved"):
788789
s = s.resolved
789790
sec = s.section

0 commit comments

Comments
 (0)