Why Rust Object Files Still Need a Linker: Symbols and Relocations

rust dev.to

When you compile Rust code, object files are produced along the way. They have the extension .o and contain machine code and data. The linker combines them to build an executable or another output. But something bothers me here. If the machine code is already there, shouldn't the CPU be able to execute it? Why is linking still necessary? Let's compile a pair of small functions separately and look at a state where the machine code exists, but the destination of a function call has not been dete

Read Full Tutorial open_in_new
arrow_back Back to Tutorials