Parsing metadata

Hello fellow compiler hackers!

I'm new to the compiler process of rust. Currently, I'm working on .rlib file and want to know some details about the metadata included in the rlib file. I have extracted the rmeta file from the rlib file, however, I found out it is also a binary file. I have tried to decode it and got some information but it is not clear enough. I wonder if there is any reliable way to parse the rmeta file giving me a clear picture of metadata.

B.T.W. I'm also confusing about the meaning of the creation of .rlib file. Because it seems that rust can also work with other format libraries like .dylib, .so, .a.

Thank you!

.rlib/.rmeta and friends are effectively unstable partial compilations that only the exact same compiler can interpret. If you want something guaranteed to work for interop with other tooling, use standard dynamic library objects for your platform.

There's a way that the RLS uses to get rustc to dump analysis in a consumable (json?) file but I don't recall the exact method off the top of my head.

Actually, I'm doing some optimization related work using llvm code generation. However, I may also need to batch the binary after generating the object file. I wonder if there is any metadata I need to concern about.

Thank you