I have a rlib generated from this repository (a HAL library that could be used in embedded Rust) and I would like to identify the instruction sequences of functions in the library for my research work. Though there are many tools that are there for different languages, I couldn't find a tool that could work with rlib's. I found Rust library for inspecting .rlib binaries, but the tool noted here does not seem to be working.
Tools for inspecting .rlib files
Asked Answered
The .rlib
format is specific to Rust, and its format is unspecified. It is essentially the respective platform's static library format with some additional metadata in additional archive members. This means that you can use whatever tool you would use on your platform to inspect static libraries.
On Linux, you can use objdump -d
to dump the disassembly of all functions in an .rlib
file. All symbols will be mangled and hard to read, though, which can be fixed with rustfilt
:
cargo install rustfilt
objdump -d whatever.rlib | rustfilt
when un archive the .rlib
file, there is a .o
file and .rmeta
file.
Since .o
is the object file and the .rmeta
look like been defined in here.
© 2022 - 2024 — McMap. All rights reserved.
.rlib
s are just static libraries with some additional metadata. What platform are you on? On Linux, you should be able to use the standard tools that work for.a
files, e.g.ar
,nm
orobjdump
. E.g.objdump -d whatever.rlib
gives me the disassembly of all functions in an rlib. A script to unmangle the Rust symbols may be helpful as well. – Myrwyncargo install rustfilt
and piping the output ofobjdump
torustfilt
should give you reasonable output. – Myrwyn