From 9184dbfcdb965a081f0654daf64cadf272b00522 Mon Sep 17 00:00:00 2001 From: Bojun Ren Date: Thu, 6 Mar 2025 12:16:35 +0800 Subject: [PATCH 1/3] gh-130673: Gracefully handle section in jit build --- Tools/jit/_targets.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index aa2b56abf446b1..75795cd0ac5f74 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -312,7 +312,10 @@ def _handle_section( 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: + return + value, base = maybe_symbol if value is _stencils.HoleValue.CODE: stencil = group.code else: From 87334a4fa1754ab14d9c82467a0764d5dd03b1ae Mon Sep 17 00:00:00 2001 From: Bojun Ren Date: Thu, 6 Mar 2025 21:00:03 +0800 Subject: [PATCH 2/3] Add a blurb entry under `Misc/NEWS.d` --- .../next/Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst diff --git a/Misc/NEWS.d/next/Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst b/Misc/NEWS.d/next/Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst new file mode 100644 index 00000000000000..20c52c3e3722b2 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-03-06-20-55-34.gh-issue-130673.T3RSCI.rst @@ -0,0 +1,2 @@ +Fix potential ``KeyError`` when handling object sections during JIT building +process. From 97c01deb0500af043013b8a9e2fcc9f720ee56a0 Mon Sep 17 00:00:00 2001 From: Bojun Ren Date: Sat, 8 Mar 2025 11:41:36 +0800 Subject: [PATCH 3/3] Add a comment for explaining --- Tools/jit/_targets.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index 75795cd0ac5f74..8da8b1a10cecec 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -314,6 +314,7 @@ def _handle_section( assert not section["Symbols"] 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: