GH-130673: Gracefully handle missing sections in JIT build (GH-130906)

This commit is contained in:
Bojun Ren 2025-03-26 07:35:39 +08:00 committed by GitHub
parent 488174dc68
commit a26a301f8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,2 @@
Fix potential ``KeyError`` when handling object sections during JIT building
process.

View file

@ -323,7 +323,11 @@ class _ELF(
if section_type == "SHT_RELA":
assert "SHF_INFO_LINK" in flags, flags
assert not section["Symbols"]
value, base = group.symbols[section["Info"]]
maybe_symbol = group.symbols.get(section["Info"])
if maybe_symbol is None:
# These are relocations for a section we're not emitting. Skip:
return
value, base = maybe_symbol
if value is _stencils.HoleValue.CODE:
stencil = group.code
else: