检查 .rlib 文件的工具
Tools for inspecting .rlib files
我有一个从 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 生成的 rlib,但这里提到的工具似乎不起作用。
.rlib
格式是 Rust 特有的,其格式未指定。它本质上是各自平台的静态库格式,在额外的存档成员中有一些额外的元数据。这意味着您可以使用您在平台上使用的任何工具来检查静态库。
在 Linux 上,您可以使用 objdump -d
将所有函数的反汇编转储到 .rlib
文件中。但是,所有符号都将被损坏且难以阅读,可以使用 rustfilt
:
修复
cargo install rustfilt
objdump -d whatever.rlib | rustfilt
解压缩 .rlib
文件时,有 .o
文件和 .rmeta
文件。
因为 .o
是目标文件并且 .rmeta
看起来像是在 here 中定义的。
我有一个从 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 生成的 rlib,但这里提到的工具似乎不起作用。
.rlib
格式是 Rust 特有的,其格式未指定。它本质上是各自平台的静态库格式,在额外的存档成员中有一些额外的元数据。这意味着您可以使用您在平台上使用的任何工具来检查静态库。
在 Linux 上,您可以使用 objdump -d
将所有函数的反汇编转储到 .rlib
文件中。但是,所有符号都将被损坏且难以阅读,可以使用 rustfilt
:
cargo install rustfilt
objdump -d whatever.rlib | rustfilt
解压缩 .rlib
文件时,有 .o
文件和 .rmeta
文件。
因为 .o
是目标文件并且 .rmeta
看起来像是在 here 中定义的。