SplitScript reference / Module / elfBuildId

Module.elfBuildId

Method

Module.elfBuildId() -> [u8]?!

Reads a GNU build ID from a mapped little-endian ELF32 or ELF64 image.

Returns None when there is no GNU build-ID note. Malformed headers, failed reads, unsupported formats, and IDs outside 1–32 bytes return an error. Notes are located using virtual addresses and the header's load segment, so relocated shared objects and non-relocated executables work alike. Work is limited to 1024 program headers and 4096 notes.

Effects: allocates, mutates the receiver, reads process memory, requires an attached process

Runtime behavior: available while a process is attached, except in onDetach; synchronous

Examples

Inspect a Linux Mono runtime's exact build identity

let runtime = await process.module("libmonobdwgc-2.0.so")
let buildId = runtime.elfBuildId()? else return
print(buildId)