From 4837ec336a8047a1707534315f6b4b8aeac3f891 Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Sun, 30 Jul 2023 15:40:39 +0200 Subject: [PATCH] tools/mpy_ld.py: Support more complex rodata sections. Sections sometimes named .rodata.str1.1 etc, instead of just .rodata. Avoid crashing in that case. Instead treat it like any other RO section. Fix thanks to @phlash. Fixes issue #8783. Signed-off-by: Jon Nordby --- tools/mpy_ld.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mpy_ld.py b/tools/mpy_ld.py index 60fa41ce1f..dd7b352b69 100755 --- a/tools/mpy_ld.py +++ b/tools/mpy_ld.py @@ -972,7 +972,7 @@ def build_mpy(env, entry_offset, fmpy, native_qstr_vals, native_qstr_objs): for base, addr, kind in env.mpy_relocs: if isinstance(kind, str) and kind.startswith(".text"): kind = 0 - elif kind in (".rodata", ".data.rel.ro"): + elif isinstance(kind, str) and kind.startswith((".rodata", ".data.rel.ro")): if env.arch.separate_rodata: kind = rodata_const_table_idx else: