Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JIT build crashes on x86_64-linux with LLVM 18 #130673

Closed
Labels
buildThe build process and cross-buildtopic-JITtype-bugAn unexpected behavior, bug, or error
@rennsax

Description

@rennsax

Bug report

Bug description:

I'm trying to build CPython 3.13.2 with JIT supported (--enable-experimental-jit=yes-off), but the build process crashes after reporting like this:

python3>     | Traceback (most recent call last):python3>     |   File "/build/Python-3.13.2/Tools/jit/_targets.py", line 181, in _compilepython3>     |     return await self._parse(o)python3>     |            ^^^^^^^^^^^^^^^^^^^^python3>     |   File "/build/Python-3.13.2/Tools/jit/_targets.py", line 89, in _parsepython3>     |     self._handle_section(wrapped_section["Section"], group)python3>     |   File "/build/Python-3.13.2/Tools/jit/_targets.py", line 330, in _handle_sectionpython3>     |     value, base = group.symbols[section["Info"]]python3>     |                   ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^python3>     | KeyError: 5

I've tracked the build process and found that the_parse routine inTools/_targets.py almost fails for all the object files produced by the_compile process. When handling a ELF section of typeSHT_PROGBITS, ifSHF_ALLOC is not included in its flags, then the symbol tables of the stencil group will not be updated. Then if a later section refers to the symbol, aKeyError occurs. For example, an object file (_NOP.o) like this:

[  {"Section": {"Index":5,"Name": {"Name":".debug_info","Value":108 },"Type": {"Name":"SHT_PROGBITS","Value":1 },"Flags": {"Value":2048,"Flags": [{"Name":"SHF_COMPRESSED","Value":2048 }]      },"Address":0,"Offset":463,"Size":29486,"Link":0,"Info":0// ...  },  {"Section": {"Index":6,"Name": {"Name":".rela.debug_info","Value":103 },"Type": {"Name":"SHT_RELA","Value":4 },"Flags": {"Value":64,"Flags": [{"Name":"SHF_INFO_LINK","Value":64 }]      },"Address":0,"Offset":44968,"Size":96,"Link":20,"Info":5// ...  }

When handling the 5th section, L349 is not executed:

elifsection_type=="SHT_PROGBITS":
if"SHF_ALLOC"notinflags:
return
if"SHF_EXECINSTR"inflags:
value=_stencils.HoleValue.CODE
stencil=group.code
else:
value=_stencils.HoleValue.DATA
stencil=group.data
group.symbols[section["Index"]]=value,len(stencil.body)
forwrapped_symbolinsection["Symbols"]:
symbol=wrapped_symbol["Symbol"]
offset=len(stencil.body)+symbol["Value"]
name=symbol["Name"]["Name"]
name=name.removeprefix(self.prefix)
group.symbols[name]=value,offset
stencil.body.extend(section["SectionData"]["Bytes"])
assertnotsection["Relocations"]

Then when handling the 6th section, L330 will try to indexgroup.symbols[5]:

ifsection_type=="SHT_RELA":
assert"SHF_INFO_LINK"inflags,flags
assertnotsection["Symbols"]
value,base=group.symbols[section["Info"]]
ifvalueis_stencils.HoleValue.CODE:
stencil=group.code
else:
assertvalueis_stencils.HoleValue.DATA
stencil=group.data
forwrapped_relocationinsection["Relocations"]:
relocation=wrapped_relocation["Relocation"]
hole=self._handle_relocation(base,relocation,stencil.body)
stencil.holes.append(hole)

where the error occurs.

I'm not sure whether it's because of the version of LLVM (18.1.8) I'm using.

CPython versions tested on:

3.13.2

Operating systems tested on:

GNU/Linux

Build Toolchains

  • Python 3.12.4
  • LLVM 18.1.8

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtopic-JITtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp