Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Nov 1, 2024
1 parent f028daa commit 85a0bdf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/symbol-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_exported_exports(library) -> list[str]:
if library.format == lief.Binary.FORMATS.ELF:
return [symbol.name for symbol in library.exported_symbols]
elif library.format == lief.Binary.FORMATS.PE:
return [function.name for function in library.exported_functions]
return [entry.name for entry in library.get_export().entries]
elif library.format == lief.Binary.FORMATS.MACHO:
return [function.name[1:] for function in library.exported_functions]
raise NotImplementedError(f"Unsupported format: {library.format}")
Expand All @@ -50,6 +50,9 @@ def grep_expected_symbols() -> list[str]:
def check_symbols(library, expected_exports) -> None:
"""Check that the library exports only the expected symbols."""
actual_exports = list(get_exported_exports(library))

print(f'actual exports are: {actual_exports}')

unexpected_exports = set(actual_exports) - set(expected_exports)
if unexpected_exports != set():
raise UnexpectedExport(f"Unexpected exported symbols: {unexpected_exports}")
Expand Down

0 comments on commit 85a0bdf

Please sign in to comment.