Parse a single .so file, extract imports, NEEDED, versions.
(path: str, pkg_dir: str)
| 183 | "__register_frame_info_bases", "__deregister_frame_info_bases", |
| 184 | "__register_frame_info_header_bases", |
| 185 | # libstdc++ |
| 186 | "__dynamic_cast", |
| 187 | } |
| 188 | |
| 189 | |
| 190 | def is_toolchain_runtime_symbol(sym: str) -> bool: |
| 191 | """True if the compiler runtime (libgcc/libstdc++) provides this symbol. |
| 192 | |
| 193 | Note __aeabi_d2iz is deliberately NOT special-cased away here: older |
| 194 | Buildroot ARM toolchains have been seen not to emit it, which is why |
| 195 | uclibc-compat carries an implementation. It is still a libgcc symbol, |
| 196 | so it is bucketed with the rest and simply not counted as a musl gap. |
| 197 | """ |
| 198 | if sym in TOOLCHAIN_RUNTIME_SYMBOLS: |
| 199 | return True |
| 200 | return any(sym.startswith(p) for p in TOOLCHAIN_RUNTIME_PREFIXES) |
| 201 | |
| 202 | |
| 203 | # --------------------------------------------------------------------------- |
| 204 | # ELF helpers |
| 205 | # --------------------------------------------------------------------------- |
| 206 | |
| 207 | def run_readelf(args: list[str], path: str) -> str: |
| 208 | try: |
| 209 | r = subprocess.run( |
| 210 | ["readelf", "-W"] + args + [path], |
| 211 | capture_output=True, text=True, timeout=10, |
| 212 | ) |
| 213 | return r.stdout |
| 214 | except (subprocess.TimeoutExpired, FileNotFoundError): |
| 215 | return "" |
| 216 | |
| 217 | |
| 218 | def is_elf(path: str) -> bool: |
no test coverage detected