Assembling and linking steps for assembly language

  • I was wondering what is the purpose of the connection step after the assembly step? Why not run assembler output without a join step?

    For C, linking consists of combining several object files created by compiling into a single object file. But for assembler, there is only one object file for "link", so why bind a file with one object? For example, http://zahidirfan.blogspot.com/2010/01/two-steps-to-using-assembly-in-linux.html

    If there is only one object file and no library is required, will binding be unnecessary? Like in the above example?

  • Draw the assembler output and the linker output has the same format? Are they both binary files?

Thank you and welcome!

+3
source share
3 answers

Assembler creates object files as output, as the compiler does.

You link them for the same reason you use libraries. The linker is also what (usually) knows about the target executable formats.

However, there are assemblers that produce executable files directly, without the involvement of the linker. If memory is used, NASM can create several executable formats directly, and some older builds for MS-DOS (like A86) can work and work in the same way.

A simpler installation and a faster build cycle with them make them really convenient for beginners, but the requirement to put all the code in one module makes it much less suitable for larger projects.

+4
source

"1" . ( ) obj, .

, , , . , ...

+1

1- , , , . 2- (1), . , .

0

All Articles