http://www.linuxjournal.com/article/6463?page=0,0 for more info.
ELF for the ARM® Architecture shows an entry point to destruct a software with section informations elf provides.
Below documents will provide more details related to each specific section.
AAPCS Procedure Call Standard for the ARM Architecture.
BSABI ABI for the ARM Architecture (Base Standard)
EHABI Exception Handling ABI for the ARM Architecture
ABI-addenda Addenda to the ABI for the ARM Architecture
DBGOVL Support for Debugging Overlaid Programs
GDWARF DWARF 3.0, the generic debug table format
Mainly, it is a story of 1 header and 2 tables.
• the ELF header
• the Program Header Table
• the Section Header Table.
ELF Header in a linking view
Program Header Table
Text segment
Data segment
BSS segment
".symtab" section
".strtab" section
".shstrtab" section
Debug sections
Section Header Table(optional, or ignored)
ELF Header in a Execution view |
.text |
.rodata |
.data |
.bss |
.symtab |
.rel.text |
.rel.data |
.debug |
.line |
.strtab |
The header contains below key info
e_machine is set to EM_ARM (defined as 40)
e_ident[EI_CLASS]
is set to ELFCLASS32
e_ident[EI_DATA]
is set to:
ELFDATA2LSB for little-endian targets
ELFDATA2MSB for big-endian targets
Entries for segments appear in the Program Header Table, There are three types of Segment:
• Text
• Data
• BSS
Text Segment
Contains the code for the executable.
p_type - set to PT_LOAD
p_vaddr - load address of the segment
p_paddr - 0
p_filesz - size of text segment
p_memsz - same as p_filesz
p_flags - PF_X + PF_R
p_align - 4
Data Segment
Contains initialized read-write data for the executable.
p_type - set to PT_LOAD
p_vaddr - load address of data segment
p_paddr - 0
p_filesz - size of data segment
p_memsz - same as p_filesz
p_flags - PF_R + PF_W
p_align - 4
BSS Segment
Contains uninitialized data, which should be zeroed either when an image is created, or
at program startup by the runtime environment. Note that a BSS Segment is
distinguished by having a p_filesz of 0 to indicate that it occupies no space in the
executable file.
p_type - set to PT_LOAD
p_vaddr - load address of BSS data segment
p_paddr - 0
p_filesz - 0 (note: occupies no file space)
p_memsz - size of BSS segment
p_flags - PF_R + PF_W
p_align - 4
Sections
Symbol Table Section
The Symbol Table Section has the following attributes:
sh_name: ".symtab"
sh_type: SHT_SYMTAB
sh_addr: 0 (to indicate it is not part of the image)
Note
In Executable ARM ELF we do not set the SHF_ALLOC bit in the sh_flags field, thus
indicating that there is no space allocated for the symbol table in the image which will
be created from this Executable.
This symbol table can be used for low-level debugging symbol information.
String Table Section
The String Table Section holds all strings referenced by other Sections in the
Executable. In particular it will hold the textual names of entries in the Symbol Table
Section. It has the following attributes:
sh_name: ".strtab"
sh_type: SHT_STRTAB
sh_addr: 0 (to indicate it is not part of the image)
Section Name String Table
The Section Name String Table holds the textual names of all sections. It has the
following attributes:
sh_name: ".shstrtab"
sh_type: SHT_STRTAB
sh_addr: 0 (to indicate it is not part of the image)
[Optional]Debugging Sections
ARM Executable ELF supports many types of debugging information held in debugging
Sections. A consumer of an ELF executable can distinguish between these three types
of debugging information by examining the Section Table for the executable:
• ASD debugging tables
These provide backwards compatibility with ARM's Symbolic Debugger. ASD
debugging information is stored in a single Section in the executable named
.asd.
• DWARF version 1.0 to 3.0
没有评论:
发表评论