feat: sections collection support - #94
Merged
Merged
Conversation
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().
Signed-off-by: Martin Olivier <martin.olivier@live.fr>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.