Linux Linker Script

Source: Internet
Author: User

Two pages are recommended first:

http://blog.csdn.net/muyuyuzhong/article/details/7755291

Http://www.cnblogs.com/liulipeng/archive/2013/10/14/3368938.html

The core section of the link script is defined as follows:

1 SECTIONS {  2    ...   3     secname start BLOCK (align) (NOLOAD): at (LDADR)  4       {contents} >region:p HDR =
   
    fill  
    5
        ...   
    6     }
   

Secname defines the segment name.

Start specifies the run address.

Block (align) specifies the alignment of blocks. For example, the previous segment from 0x3000_000 to 0x3000_03f1, where the mark align (4), indicating that the minimum occupancy of 4Byte, even if the next segment is close to this segment, then the starting address of the next segment (that is, the run address) is 0X3000_03F4. See the kernel of the link script vmlinux.lds (arch/arm/kernel/vmlinux.lds) will appear a lot of align (1<<12) or align (8192), and so on, specify the next paragraph address the same principle is the same.

NOLOAD tells the loader that the program does not load this section while it is running. This field tells me an important message with the loader this thing. When the program moves from Flash to SDRAM, it uses the loader thing.

At (LDADDR): Specifies the address of this segment in the compiled impression file--load address. In the first recommended Web page, Cnblog netizens about loading addresses and running addresses is very difficult to understand, he will load the address understood as stored in flash address. But the problem is, Nandflash is hanging on the CPU bus system, how to determine the address of nandflash, can only say that a section relative to the entire start of the executable file position. In Vedon's book, the explanation for this is "through this option, you can control each section to save the output file in different locations, easy to save the file on a single board: a section placed at a, B section at B Place, before the operation of A, B read out the first to assemble a complete execution program. "It's also very vague, keep it, and watch it later."

For examples of linking scripts, see the example of Cnblog netizens.

Two important tool directives: arm-linux-objdump-h vmlinux > Vmlinux.txt output Linux kernel segment information into vmlinux.txt text.

Arm-linux-objdump-f vmlinux > Sec_symbol.txt output kernel segment information and symbols into sec_symbol.txt text.

Linux Linker Script

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.