Linker&loader

Source: Internet
Author: User

This digest from: self-cultivation of programmers-linking, loading and library

The format of the destination file and the executable file is similar, and the contents of the dynamic-link library and the static-link library are very similar to the executable file. For dynamic-link and static-link libraries, the. dll and. lib files are under Windows, respectively, and. So asking prices and. A files under Linux.

For executables or target files, they all have file headers. The file header describes whether the file is an executable file or a linked file or a library file.

Reasons to fragment executable files:

① Protect code Snippets.

② because the CPU cache is limited, reducing the size of the buffer can increase or decrease the hit ratio.

⑤ can share code snippets.

There are two main types of data in the target file: code and data.

Elf Head Information in this document
Section Head Table

to describe the information for each segment, such as the name of the segment and the position and offset of the segment

. Init
. text Code snippet
. rodata Read-only data area Read-only data, such as a string or const constant
. Data Data segment Global variables and local static variables
. BSS does not occupy space Uninitialized global variable and local static variable default value is 0
. symtab Symbol table
. Debug Debugging information
. Line
. strtab String table
Section Header table

You can have custom segments in your executable, for example, you can use the tool objcopy to write binary files (a picture) into an executable file.

Linker&loader

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.