hEShaN
hEShaN

Reputation: 581

Tools for inspecting .rlib files

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.

Upvotes: 7

Views: 3549

Answers (2)

radong
radong

Reputation: 45

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.

Upvotes: -2

Sven Marnach
Sven Marnach

Reputation: 602205

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

Upvotes: 9

Related Questions