Skip to content

feat: sections collection support - #94

Merged
martin-olivier merged 8 commits into
mainfrom
feat/sections
Aug 3, 2026
Merged

feat: sections collection support#94
martin-olivier merged 8 commits into
mainfrom
feat/sections

Conversation

@martin-olivier

Copy link
Copy Markdown
Owner

No description provided.

Signed-off-by: Martin Olivier <martin.olivier@live.fr>
Signed-off-by: Martin Olivier <martin.olivier@live.fr>
Signed-off-by: Martin Olivier <martin.olivier@live.fr>
Gate the MSVC-only #pragma section/__declspec(allocate) on _MSC_VER
instead of _WIN32, since MinGW GCC/Clang also define _WIN32 but don't
support those extensions, causing -Werror build failures. Also shorten
the custom section name to 8 chars ("testsec"), since PE section
headers truncate longer names in the final image, which made the
lookup test fail on Windows.
… dedup sections

- tests/lib.cpp: mark the MSVC custom section read/write so the
  symbols.variables test's write through pi_value_c isn't relying on
  incidental linker page-packing to avoid an access violation.
- dylib.hpp: introduce dylib::collection_error as a shared parent for
  symbol_collection_error and the new section_collection_error, since
  collecting sections is not a symbol-resolution failure.
- symbols.cpp: dedup section names on Windows and Linux using
  std::find, matching the existing Mach-O behavior, and simplify the
  Mach-O dedup loop to use std::find as well.
- symbols.cpp: drop the unused link_map pointer left over from copying
  the get_symbols() pattern into get_sections() on Linux.
- README: document the sections() method and the collection_error
  exception, mirroring the existing symbols() documentation.
- tests: assert sections() returns no duplicates, and that it throws
  std::logic_error on a moved-from library, mirroring the existing
  moved-from coverage for get_variable().
@martin-olivier martin-olivier self-assigned this Aug 3, 2026
@martin-olivier martin-olivier added the enhancement New feature or request label Aug 3, 2026
Signed-off-by: Martin Olivier <martin.olivier@live.fr>
@martin-olivier
martin-olivier merged commit afd7947 into main Aug 3, 2026
138 checks passed
@martin-olivier
martin-olivier deleted the feat/sections branch August 3, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant