Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ci/release_artifact_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
# REL-009 owner rule (#296): debug symbols ship only as GitHub release
# sidecars, never inside a wheel.
SYMBOL_SUFFIXES = (".pdb", ".debug", ".dwp", ".dwo", "-symbols.tar.zst")
# rustc's gdb pretty-printer loader: not DWARF, and `strip --strip-debug`
# deliberately keeps it (forge-ci/ci.yml#574).
NON_DWARF_DEBUG_SECTIONS = frozenset({".debug_gdb_scripts"})


def _elf_debug_sections(data: bytes) -> list[str]:
Expand All @@ -45,7 +48,10 @@ def header(index: int) -> bytes:
for index in range(shnum):
name_off = int.from_bytes(header(index)[0:4], "little")
name = names[name_off:].split(b"\0", 1)[0].decode("latin-1")
if name.startswith((".debug_", ".zdebug_")):
if (
name.startswith((".debug_", ".zdebug_"))
and name not in NON_DWARF_DEBUG_SECTIONS
):
found.append(name)
return found

Expand Down
18 changes: 18 additions & 0 deletions tests/unit/test_ci_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,3 +607,21 @@ def log_message(self, format, *args):
assert verify.download(f"http://127.0.0.1:{port}/zip") == b"zipbytes"
finally:
server.shutdown()


def test_release_artifact_lint_allows_debug_gdb_scripts_only():
"""`strip --strip-debug` keeps rustc's .debug_gdb_scripts (not DWARF), forge-ci/ci.yml#574."""
kept = _elf64([".text", ".debug_gdb_scripts", ".gnu_debuglink"])
assert artifacts.wheel_symbol_problems({"fastled/bin/fastled": kept}) == []
for dwarf in (
".debug_info",
".debug_line",
".debug_abbrev",
".debug_str",
".debug_ranges",
".zdebug_info",
):
image = _elf64([".text", ".debug_gdb_scripts", dwarf])
problems = artifacts.wheel_symbol_problems({"fastled/bin/fastled": image})
assert problems and dwarf in problems[0], dwarf
assert ".debug_gdb_scripts" not in problems[0], dwarf
Loading