diff --git a/Misc/linkers.md b/Misc/linkers.md index 35e5767..a999111 100644 --- a/Misc/linkers.md +++ b/Misc/linkers.md @@ -11,7 +11,7 @@ If we open the `Linker` page on Wikipedia, we will see following definition: >In computer science, a linker or link editor is a computer program that takes one or more object files generated by a compiler and combines them into a single executable file, library file, or another object file. ->在计算机科学中,链接器(英语:Linker),又译为链接器、连结器,是一个程序,将一个或多个由编译器或汇编器生成的目标文件链接为一个可执行文件、库或另一个目标文件。 +>在计算机科学中,链接器(英语:Linker),又译为链接器、连结器,是一个程序,能够将一个或多个由编译器或汇编器生成的目标文件链接为一个可执行文件、库或另一个目标文件。 If you've written at least one program on C in your life, you will have seen files with the `*.o` extension. These files are [object files](https://en.wikipedia.org/wiki/Object_file). Object files are blocks of machine code and data with placeholder addresses that reference data and functions in other object files or libraries, as well as a list of its own functions and data. The main purpose of the linker is collect/handle the code and data of each object file, turning it into the final executable file or library. In this post we will try to go through all aspects of this process. Let's start. @@ -102,7 +102,7 @@ main.o: U printf The `nm` util allows us to see the list of symbols from the given object file. It consists of three columns: the first is the name of the given object file and the address of any resolved symbols. The second column contains a character that represents the status of the given symbol. In this case the `U` means `undefined` and the `T` denotes that the symbols are placed in the `.text` section of the object. The `nm` utility shows us here that we have three symbols in the `main.c` source code file: -`nm` 工具让我们能够看到给定目标文件的符号表列表。其包含了三列:第一列是该目标文件的名称和解析得到的符号地址。第二列包含了一个表示该符号状态的字符。这里 `U` 表示 `未定义`, `T` 表示该符号被置于 `.text` 段。在这里, `nm` 工具向我们展示了 `main.c` 文件里包含的三个符号: +`nm` 工具让我们能够看到给定目标文件的符号列表。其包含了三列:第一列是该目标文件的名称和解析得到的符号地址。第二列包含了一个表示该符号状态的字符。这里 `U` 表示 `未定义`, `T` 表示该符号被置于 `.text` 段。在这里, `nm` 工具向我们展示了 `main.c` 文件里包含的三个符号: * `factorial` - the factorial function defined in the `lib.c` source code file. It is marked as `undefined` here because we compiled only the `main.c` source code file, and it does not know anything about code from the `lib.c` file for now; * `main` - the main function;