Chapter 7 linking -- 1 (csapp Reading Notes)

Source: Internet
Author: User

 
 
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 ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.