diff options
author | Alessandro Gatti <a.gatti@frob.it> | 2024-08-28 15:05:47 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-09-06 17:10:07 +1000 |
commit | a831c788f76c0742f85b8a35a5860255229b98dc (patch) | |
tree | 06f3269b6935f2308d85dee91e7429255ef4b716 | |
parent | e370999e378bf5040ef6348e2a0720bc3ec4f773 (diff) |
tools/mpy_ld.py: Ignore R_XTENSA_ASM_EXPAND relocation entries.
As reported in #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>
-rwxr-xr-x | tools/mpy_ld.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/mpy_ld.py b/tools/mpy_ld.py index 7046b6a85..45aadadd5 100755 --- a/tools/mpy_ld.py +++ b/tools/mpy_ld.py @@ -69,6 +69,7 @@ R_XTENSA_PLT = 6 R_386_GOTOFF = 9 R_386_GOTPC = 10 R_ARM_THM_CALL = 10 +R_XTENSA_ASM_EXPAND = 11 R_XTENSA_DIFF32 = 19 R_XTENSA_SLOT0_OP = 20 R_ARM_BASE_PREL = 25 # aka R_ARM_GOTPC @@ -562,9 +563,14 @@ def do_relocation_text(env, text_addr, r): reloc = addr - r_offset reloc_type = "xtensa_l32r" - elif env.arch.name == "EM_XTENSA" and r_info_type in (R_XTENSA_DIFF32, R_XTENSA_PDIFF32): + elif env.arch.name == "EM_XTENSA" and r_info_type in ( + R_XTENSA_DIFF32, + R_XTENSA_PDIFF32, + R_XTENSA_ASM_EXPAND, + ): if s.section.name.startswith(".text"): - # it looks like R_XTENSA_[P]DIFF32 into .text is already correctly relocated + # it looks like R_XTENSA_[P]DIFF32 into .text is already correctly relocated, + # and expand relaxations cannot occur in non-executable sections. return assert 0 |