INNER CODE UNIT · Python

get_exported_exports

BlockstreamResearch/secp256k1-zkp · tools/symbol-check.py:26

def get_exported_exports(library) -> list[str]:
    """Adapter function to get exported symbols based on the library format."""
    if library.format == lief.Binary.FORMATS.ELF:
        return [symbol.name for symbol in library.exported_symbols]
    elif library.format == lief.Binary.FORMATS.PE:
        return [entry.name for entry in library.get_export().entries]
    elif library.format == lief.Binary.FORMATS.MACHO:
        return [symbol.name[1:] for symbol in library.exported_symbols]
    raise NotImplementedError(f"Unsupported format: {library.format}")


def grep_expected_symbols() -> list[str]:
    """Guess the list of expected exported symbols from the source code."""
    grep_output = subprocess.check_output(
        ["git", "grep", r"^\s*SECP256K1_API", "--", "include"],
        universal_newlines=True,
        encoding="utf-8"
    )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…