why do we separate linkers and loaders into separate programs
Guys I want to why should we separate the linker and loaders prog? What I understand is that linker's produc开发者_JAVA技巧e a relocatable code and also build the symbol table and also provide info about any dynamically linked lib, and the loader's 've to just load the executable files into memory? Why cant we merge them both?
Thanks
There are a number of reasons. One has to do with static libraries, which may contain thousands of different functions. But a single program might use only a few of the functions that are in a particular library. If the linker and loader were the same program, you'd have to ship the entire static library with your application. Think of a small C++ program that's only a few kilobytes in size. It's created by linking against the static runtime library, that is many megabytes in size.
If you require the loader to do the linking, you increase the complexity of the loader and increase the size of the operating system kernel. Linking is a hugely complex job that can take significant time. It's not the job of the operating system. The OS should be concerned with executing programs, not building them.
精彩评论