Skip to content

Commit 55160bf

Browse files
committed
Merge branch 'main' into windows-add-sys-abiflags
2 parents 5401970 + a26a301 commit 55160bf

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
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.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
clang-cl on Windows needs option ``/EHa`` to support SEH (structured
2+
exception handling) correctly. Fix by Chris Eibl.

PCbuild/pyproject-clangcl.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838

3939
<ItemDefinitionGroup>
4040
<ClCompile>
41+
<!--
42+
ExceptionHandling=Async sets MSVC's /EHa (-fasync-exceptions in clang)
43+
For clang, /EHa just has a slightly different meaning compared to MSVC,
44+
so this option is needed to handle SEH correctly
45+
(even though MSVC does not need it).
46+
Please see GH-131691 for details.
47+
-->
48+
<ExceptionHandling>Async</ExceptionHandling>
4149
<AdditionalOptions>-Wno-deprecated-non-prototype -Wno-unused-label -Wno-pointer-sign -Wno-incompatible-pointer-types-discards-qualifiers -Wno-unused-function %(AdditionalOptions)</AdditionalOptions>
4250
<AdditionalOptions Condition="'$(Platform)' == 'Win32'">-m32 %(AdditionalOptions)</AdditionalOptions>
4351
<AdditionalOptions Condition="'$(Platform)' == 'x64'">-m64 %(AdditionalOptions)</AdditionalOptions>

PCbuild/pyproject.props

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@
2525
<LinkIncremental Condition="$(Configuration) != 'Debug'">false</LinkIncremental>
2626
</PropertyGroup>
2727

28-
<!-- We need the above overridden OutDir, so this must be imported after PropertyGroup -->
29-
<Import Project="pyproject-clangcl.props" Condition="$(PlatformToolset) == 'ClangCL' and $(__PyprojectClangCl_Props_Imported) != 'true'" />
30-
3128
<PropertyGroup Condition="$(TargetExt) != ''">
3229
<TargetNameExt>$(TargetName)$(TargetExt)</TargetNameExt>
3330
<_TargetNameSep>$(TargetNameExt.LastIndexOf(`.`))</_TargetNameSep>
@@ -130,6 +127,13 @@
130127
</Midl>
131128
</ItemDefinitionGroup>
132129

130+
<!--
131+
We need the overridden OutDir (PropertyGroup Label="Globals"),
132+
and want to be able to override some ClCompile parameters,
133+
so this must not be included erlier.
134+
-->
135+
<Import Project="pyproject-clangcl.props" Condition="$(PlatformToolset) == 'ClangCL' and $(__PyprojectClangCl_Props_Imported) != 'true'" />
136+
133137
<UsingTask TaskName="KillPython" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
134138
<ParameterGroup>
135139
<FileName Required="true" />

Tools/jit/_targets.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,11 @@ def _handle_section(
323323
if section_type == "SHT_RELA":
324324
assert "SHF_INFO_LINK" in flags, flags
325325
assert not section["Symbols"]
326-
value, base = group.symbols[section["Info"]]
326+
maybe_symbol = group.symbols.get(section["Info"])
327+
if maybe_symbol is None:
328+
# These are relocations for a section we're not emitting. Skip:
329+
return
330+
value, base = maybe_symbol
327331
if value is _stencils.HoleValue.CODE:
328332
stencil = group.code
329333
else:

0 commit comments

Comments
 (0)