← index #8781Issue #8436
Related · high · value 2.090
QUERY · ISSUE

mpy_ld.py: R_XTENSA_NDIFF32 not supported

openby phlashopened 2022-06-19updated 2026-03-19
bugtools

Similar to #8436, this appears to be yet another informational / relaxation-only reloc record type (62), which I have encountered in the object file output of the latest ESP-IDF compiler for ESP32S3 xtensa-esp32s3-elf-gcc (crosstool-NG esp-2022r1-RC1) 11.2.0

Reloc type details found here: https://github.com/jcmvbkbc/xtensa-abi/blob/master/relocations

I have applied a similar fix (ignoring the entry) to my local mpy_ld.py, which seems happier (although I am finding other issues, to be reported shortly!)

Diff:

@@ -76,6 +76,7 @@ R_X86_64_GOTPCREL = 9
 R_X86_64_REX_GOTPCRELX = 42
 R_386_GOT32X = 43
 R_XTENSA_PDIFF32 = 59
+R_XTENSA_NDIFF32 = 62
 
 ################################################################################
 # Architecture configuration
@@ -575,9 +576,9 @@ 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_NDIFF32):
         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|N]DIFF32 into .text is already correctly relocated
             return
         assert 0
CANDIDATE · ISSUE

mpy_ld/esp32: cannot handle reloc-type #59 (R_XTENSA_PDIFF32) on idf 4.3.1

closedby mglieweopened 2022-03-22updated 2022-06-09
port-esp32

Hi,
while playing around, i found that on esp32 some of the native examples wouldn't build (btree fro instance).

mpy_ld complaint about an unknow relocation type 59 (denoted R_XTENSA_PDIFF32 in xtensa bfd sources).

After some digging around in the xtensa bfd sources, i found out, these seems to be an unsigned version of the already used relocation type R_XTENSA_DIFF32, so just dealing equaly seemed to fix that problem. Unfortunately I didn't really found any docs about these relocation entries, so thats more or less a guess.

lg maG

$ idf.py --version
ESP-IDF v4.3.1-dirty
$ xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG esp-2021r1) 8.4.0

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied