Static linking
Object fileRelocatable object fileExecutable object fileShared object file: A special type of relocatable object file
Currently, Unix-like systems mainly use the object file type elf (UNIX executable and linkable format ). In this file type, the main section of the header file is as follows:
Note that. text ,. data ,. three BSS segments. linker only cares about global variables when linking the C language OBJ file, and the local variables are handed over to the stack when the program is running for management. Note that the local linker symbol! = Local program symbol is essentially different from each other. When judging the sections occupied by each symbol, can we simply consider it as: the local program symbol is not in. symtab, and the global symbol needs to identify whether it is extern or not, and whether it is initialized. The initialized symbol exists in the. Data Segment, And the uninitialized symbol exists in the. BSS segment. P.s .. BSS can easily remember the best save space ( ̄ ー  ̄). In addition, the static keyword in C can be understood as the encapsulation of the variable settings by the file's external department, that is, the so-called access permission (public, private ...... A c file can be seen as a separate module. To be continued ......