Description
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 _compile
python3> | return await self._parse(o)
python3> | ^^^^^^^^^^^^^^^^^^^^
python3> | File "/build/Python-3.13.2/Tools/jit/_targets.py", line 89, in _parse
python3> | self._handle_section(wrapped_section["Section"], group)
python3> | File "/build/Python-3.13.2/Tools/jit/_targets.py", line 330, in _handle_section
python3> | value, base = group.symbols[section["Info"]]
python3> | ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
python3> | KeyError: 5
I've tracked the build process and found that the _parse
routine in Tools/_targets.py
almost fails for all the object files produced by the _compile
process. When handling a ELF section of type SHT_PROGBITS
, if SHF_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, a KeyError
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:
Lines 340 to 357 in 4f8bb39
Then when handling the 6th section, L330 will try to index group.symbols[5]
:
Lines 327 to 339 in 4f8bb39
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