Skip to content

Commit 9db0563

Browse files
committed
Ditto for ELF
1 parent 4e5554c commit 9db0563

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Tools/jit/_schema.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class ELFSection(typing.TypedDict):
102102
Info: int
103103
Relocations: list[dict[typing.Literal["Relocation"], ELFRelocation]]
104104
SectionData: dict[typing.Literal["Bytes"], list[int]]
105+
Size: int
105106
Symbols: list[dict[typing.Literal["Symbol"], _ELFSymbol]]
106107
Type: dict[typing.Literal["Name"], str]
107108

Tools/jit/_targets.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def _handle_section(
390390
relocation = wrapped_relocation["Relocation"]
391391
hole = self._handle_relocation(base, relocation, stencil.body)
392392
stencil.holes.append(hole)
393-
elif section_type == "SHT_PROGBITS":
393+
elif section_type in {"SHT_PROGBITS", "SHT_NOBITS"}:
394394
if "SHF_ALLOC" not in flags:
395395
return
396396
if "SHF_EXECINSTR" in flags:
@@ -399,7 +399,11 @@ def _handle_section(
399399
else:
400400
value = _stencils.HoleValue.DATA
401401
stencil = group.data
402-
section_data_bytes = section["SectionData"]["Bytes"]
402+
if section_type == "SHT_PROGBITS":
403+
section_data_bytes = section["SectionData"]["Bytes"]
404+
else:
405+
# Zeroed BSS data:
406+
section_data_bytes = [0] * section["Size"]
403407
if "SHF_WRITE" in flags:
404408
assert value is _stencils.HoleValue.DATA
405409
value = _stencils.HoleValue.WRITABLE

0 commit comments

Comments
 (0)