Skip to content

fix(elf): make Note::type_to_str namespace-aware#531

Open
leno23 wants to merge 1 commit into
m4b:masterfrom
leno23:fix-note-type-to-str-410
Open

fix(elf): make Note::type_to_str namespace-aware#531
leno23 wants to merge 1 commit into
m4b:masterfrom
leno23:fix-note-type-to-str-410

Conversation

@leno23

@leno23 leno23 commented May 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Makes Note::type_to_str resolve note types based on the note namespace (n_name) instead of n_type alone
  • Adds NT_VERSION and NT_ARCH constants for the default/unknown namespace
  • Splits type resolution into GNU, CORE, and default helpers per elf(5)

Fixes #410

Test plan

  • cargo test --features alloc elf::note::tests
  • Added type_to_str_respects_namespace covering GNU/default/CORE disambiguation for type value 1

ELF note type constants such as NT_VERSION (1), NT_GNU_ABI_TAG (1), and
NT_PRSTATUS (1) share the same numeric value but belong to different
namespaces. Resolve the type string based on n_name instead of n_type
alone, following elf(5).

Fixes m4b#410

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Note::type_to_str is only valid when n_name is "GNU"

1 participant