Skip to content

Commit 2745aa4

Browse files
rennsaxmiss-islington
authored andcommitted
GH-130673: Gracefully handle missing sections in JIT build (GH-130906)
(cherry picked from commit a26a301) Co-authored-by: Bojun Ren <bj.ren.coding@outlook.com>
1 parent 91ae330 commit 2745aa4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix potential ``KeyError`` when handling object sections during JIT building
2+
process.

Tools/jit/_targets.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,11 @@ def _handle_section(
330330
if section_type == "SHT_RELA":
331331
assert "SHF_INFO_LINK" in flags, flags
332332
assert not section["Symbols"]
333-
value, base = group.symbols[section["Info"]]
333+
maybe_symbol = group.symbols.get(section["Info"])
334+
if maybe_symbol is None:
335+
# These are relocations for a section we're not emitting. Skip:
336+
return
337+
value, base = maybe_symbol
334338
if value is _stencils.HoleValue.CODE:
335339
stencil = group.code
336340
else:

0 commit comments

Comments
 (0)