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 <jononor@gmail.com>
This commit is contained in:
Jon Nordby 2023-07-30 15:40:39 +02:00 committed by Damien George
parent d1f288c041
commit 4837ec336a
1 changed files with 1 additions and 1 deletions

View File

@ -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: