Strtab symtab shstrtab

Source: Internet
Author: User

About. strtab,. symtab,. shstrtab
. Strtab is a string table)
. Shstrtab is a string table (section header string table ).
. Symtab is a symbol table, which is generally a variable or function.

Shstrtab and symtab often reference strings in strtab.

Many special symbols will be defined in the LD link script, which are not in yourProgramBut you can declare and apply them directly, which is called a special symbol.
View the LD default link script:
LD-verbose
We do not need to define these special symbols. We only need to declare the references to use them. The linker will parse the program into a correct value when it finally links it into an executable file, only
These symbols exist only when the LD link is used to generate the final executable file.

The following addresses are all virtual addresses when the program is loaded:
_ Executable_start indicates the starting address of the program. Note that it is not the entry address, but the initial address of the program.
_ Etext, _ etext, or etext. the symbol isCodeThe end address of the segment, that is, the end address of the code segment.
_ Edata or edata indicates the end address of the Data Segment, that is, the end address of the Data Segment.
_ End or end, which is the end address of the program.

 

1 # include <stdio. h>
2
3 extern char _ executable_start [];
4 extern char etext [], _ etext [], _ etext [];
5 extern char edata [], _ edata [];
6 extern char end [], _ end [];
7
8 int main (void)
9 {
10 Printf ("executable start % P \ n", _ executable_start );
11 printf ("text end % P \ n", etext, _ etext, _ etext );
12 printf ("data end % P \ n", edata, _ edata );
13 printf ("executable end % P \ n", end, _ end );
14 return 0;
15}

 

Output result:

Executable start 0x400000
Text end 0x400656 0x400656 0x400656
Data end 0x601020 0x601020
Executable end 0x601030 0x601030

1 # include <stdio. h>
2
3 Extern char _ executable_start;
4 extern char etext [], _ etext [], _ etext [];
5 extern char edata [], _ edata [];
6 extern char end [], _ end [];
7
8 int main (void)
9 {
10 printf ("executable start % x \ n", _ executable_start );
11 printf ("executable start % P \ n", & __ executable_start );
12 printf ("text end % P \ n", etext, _ etext, _ etext );
13 printf ("data end % P \ n", edata, _ edata );
14 printf ("executable end % P \ n", end, _ end );
15 return 0;
16}

Output result:

Executable start 7f
Executable start 0x400000
Text end 0x400676 0x400676 0x400676
Data end 0x601020 0x601020
Executable end 0x601030 0x601030

 

 

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.