-
Notifications
You must be signed in to change notification settings - Fork 1
Add LIEF-backed exports command and integrate LIEF into build, CI, and packaging
#5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
YSaxon
wants to merge
3
commits into
master
Choose a base branch
from
codex/add-symbol-listing-feature-in-repl-mode-sywylm
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| [requires] | ||
| libffi/3.4.6 | ||
| readline/8.2 | ||
| lief/0.16.2 |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| #include "export_symbols.h" | ||
|
|
||
| #include <stdio.h> | ||
|
|
||
| #if defined(CLIFFI_HAS_LIEF) | ||
| #include <LIEF/LIEF.hpp> | ||
| #include <memory> | ||
| #include <string> | ||
|
|
||
| bool list_exported_symbols_with_lief(const char* library_path) { | ||
| std::unique_ptr<LIEF::Binary> binary = LIEF::Parser::parse(library_path); | ||
| if (!binary) { | ||
| fprintf(stderr, "Error: Failed to parse '%s' using LIEF\n", library_path); | ||
| return false; | ||
| } | ||
|
|
||
| size_t exported_count = 0; | ||
| const auto exported = binary->exported_functions(); | ||
| for (const std::string& symbol_name : exported) { | ||
| printf("%s\n", symbol_name.c_str()); | ||
| exported_count++; | ||
| } | ||
|
|
||
| printf("Total exported symbols: %zu\n", exported_count); | ||
| return true; | ||
| } | ||
|
|
||
| #else | ||
|
|
||
| bool list_exported_symbols_with_lief(const char* library_path) { | ||
| (void)library_path; | ||
| fprintf(stderr, | ||
| "Error: This build does not include LIEF support. Rebuild with a LIEF dependency to use 'exports'.\n"); | ||
| return false; | ||
| } | ||
|
|
||
| #endif |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #ifndef EXPORT_SYMBOLS_H | ||
| #define EXPORT_SYMBOLS_H | ||
|
|
||
| #include <stdbool.h> | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| bool list_exported_symbols_with_lief(const char* library_path); | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting
compiler.libcxxtoc++_sharedmakes the Androidcliffi/test binaries depend onlibc++_shared.so, but the Android test flow only pushescliffi,libcliffi_test.so, andcliffi_unit_teststo/data/local/tmp(seeprepare_and_test_via_adb.sh), so emulator runs can fail at process startup with a missing runtime library. This regression is specific to Android jobs in the dockcross workflow and can break those builds/tests even before any test logic runs.Useful? React with 👍 / 👎.