📜  链接器和加载器之间的区别

📅  最后修改于: 2021-06-28 07:19:38             🧑  作者: Mango

在执行该程序时,两个实用程序(称为LinkerLoader)扮演着主要角色。

1.连结器:
链接器是一个特殊程序,它将目标文件(由编译器/汇编器生成)与其他代码段组合在一起,以生成可执行文件所具有的内容。 exe扩展名。在目标文件中,链接器搜索并附加执行文件所需的所有库。它调节每个模块的代码将保存的内存空间。它还合并两个或更多单独的目标程序,并在它们之间建立链接。通常,链接器有两种类型:

1. Linkage Editor
2. Dynamic Linker 

2.装载机:
加载程序是一种特殊程序,它从链接器获取目标代码的输入,将其加载到主存储器中,并准备该代码以供计算机执行。加载程序为程序分配内存空间。甚至它也确定了对象之间的符号引用。它负责在操作系统中加载程序和库。嵌入式计算机系统没有装载程序。在它们中,代码通过ROM执行。通常,加载程序有以下三种类型的方法:

1. Absolute loading
2. Relocatable loading
3. Dynamic run-time loading 

链接器和加载器之间的区别:

S.No. LINKER LOADER
1 The main function of Linker is to generate executable files. Whereas main objective of Loader is to executable files to main memory.
2 The linker takes input of object code generated by compiler/assembler. And the loader takes input of executable files generated by linker.
3 Linking can be defined as process of combining various pieces of codes and source code to obtain executable code. Loading can be defined as process of loading executable codes to main memory for further execution.
4 Linker is of 2 types: Linkage Editor and Dynamic Linker. Loader is of 3 types: Absolute loading, Relocatable loading and Dynamic run-time loading.
5 Another use of linker is to combine all object modules. It helps in allocating the address to executable codes/files.
6 Linker is also responsible for arranging objects in program’s address space. Loader is also responsible for adjusting references which are used within the program.