10000 tools/mpy_ld.py: Ignore R_XTENSA_ASM_EXPAND relocation entries. · cuatrobits/micropython@a831c78 · GitHub
[go: up one dir, main page]

Skip to content

Commit a831c78

Browse files
agattidpgeorge
authored andcommitted
tools/mpy_ld.py: Ignore R_XTENSA_ASM_EXPAND relocation entries.
As reported in micropython#14430 the Xtensa compiler can add R_XTENSA_ASM_EXPAND relocation relaxation entries in object files, and they were not supported by mpy_ld. This commit adds handling for that entry, doing nothing with it, as it is only of real use for an optimising linker. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
1 parent e370999 commit a831c78

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tools/mpy_ld.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
R_386_GOTOFF = 9
7070
R_386_GOTPC = 10
7171
R_ARM_THM_CALL = 10
72+
R_XTENSA_ASM_EXPAND = 11
7273
R_XTENSA_DIFF32 = 19
7374
R_XTENSA_SLOT0_OP = 20
7475
R_ARM_BASE_PREL = 25 # aka R_ARM_GOTPC
@@ -562,9 +563,14 @@ def do_relocation_text(env, text_addr, r):
562563
reloc = addr - r_offset
563564
reloc_type = "xtensa_l32r"
564565

565-
elif env.arch.name == "EM_XTENSA" and r_info_type in (R_XTENSA_DIFF32, R_XTENSA_PDIFF32):
566+
elif env.arch.name == "EM_XTENSA" and r_info_type in (
567+
R_XTENSA_DIFF32,
568+
R_XTENSA_PDIFF32,
569+
R_XTENSA_ASM_EXPAND,
570+
):
566571
if s.section.name.startswith(".text"):
567-
# it looks like R_XTENSA_[P]DIFF32 into .text is already correctly relocated
572+
# it looks like R_XTENSA_[P]DIFF32 into .text is already correctly relocated,
573+
# and expand relaxations cannot occur in non-executable sections.
568574
return
569575
assert 0
570576

0 commit comments

Comments
 (0)
0