INNER CODE UNIT · Python
_max_glibc_requirement
briscverse/ryp · ryp.py:129
def _max_glibc_requirement(lib_path: str) -> tuple[int, ...] | None:
"""
Return the highest glibc version a shared library requires. Read statically
without loading the library, so that a library built against a newer glibc
than this process can be detected and skipped rather than loaded (which
could crash the interpreter). Both numeric symbol versions (GLIBC_2.36) and
the ABI tag GLIBC_ABI_DT_RELR (introduced in 2.36) are used to infer glibc
versions.
Args:
lib_path: the path to the shared library
Returns:
The highest glibc version the shared library requires, as a tuple
(e.g. (2, 36)), or None if it cannot be read.
"""
for tool in (['objdump', '-p', lib_path], ['readelf', '-V', lib_path]):
try: