How to get the command line used to build object file

In building libstd, many object files are created under build/x86_64-unknown-linux-gnu/stage1-std/powerpc-wrs-vxworks-gnu/release/deps/ :

build/x86_64-unknown-linux-gnu/stage1-std/powerpc-wrs-vxworks-gnu/release/deps/std-3941da31e683f62e.11pg4okzsg3069rb.rcgu.o

build/x86_64-unknown-linux-gnu/stage1-std/powerpc-wrs-vxworks-gnu/release/deps/std-3941da31e683f62e.11qsgc0t7ja38v7u.rcgu.o

build/x86_64-unknown-linux-gnu/stage1-std/powerpc-wrs-vxworks-gnu/release/deps/std-3941da31e683f62e.12xus0r4i96p6l6f.rcgu.o

build/x86_64-unknown-linux-gnu/stage1-std/powerpc-wrs-vxworks-gnu/release/deps/std-3941da31e683f62e.13ix02qmmbhqrmwn.rcgu.o

Is there a way to get the command line used to build these object file? I have tried to use option ā€œ-vā€ but it only shows the command line used to build the while crate.

Also from the object file name like std-3941da31e683f62e.13ix02qmmbhqrmwn.rcgu.o, is there a easy way to tell from which souce file the object file has been created?

Thanks, Baoshan

They are the same. You execute rustc on one crate and that single process does some analysises on the crate as a whole and then uses LLVM to create one or more object files and then links them all together.

There is no correspondance between object files and source files. A single object file will contain functions from several source files. A single source file will have its functions spread across several object files. Rustc tries to be as smart as possible with its assignment of functions to object files, so that functions can be inlined more often. (there is no cross object file inlining unless link time optimization is enabled)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.