Linux Kernel Architecture

(Jacob Rumans) #1
Mauerer runapp05.tex V1 - 09/04/2008 6:13pm Page 1246

Appendix E: The ELF Binary Format


0x00000000000001a0 0x00000000000001a0 RW 8
NOTE 0x00000000000001e0 0x40000000000001e0 0x40000000000001e0
0x0000000000000020 0x0000000000000020 R 4
IA_64_UNWIND 0x00000000000009a8 0x40000000000009a8 0x40000000000009a8
0x0000000000000048 0x0000000000000048 R 8

Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.ABI-tag .hash .dynsym .dynstr .gnu.version .gnu.version_r
.rela.IA_64.pltoff .init .plt .text .fini .rodata .opd
.IA_64.unwind_info .IA_64.unwind
03 .data .dynamic .ctors .dtors .jcr .got .IA_64.pltoff .sdata .sbss .bss
04 .dynamic
05 .note.ABI-tag
06 .IA_64.unwind

Notwithstanding the fact that 64-bit addresses are used, it is also apparent that a further section of the
IA_64_UNWINDtype has been added. This section storesunwind informationthat is used to analyze stack
frames (if, for example, a backtrace is to be generated) because, for architecture-specific reasons, this
cannot be done on IA-64 systems by simply analyzing the stack contents.^4 The exact meanings of the
various sections are discussed next.

The segments can overlap, as thereadelfoutput for IA-32 shows. Segment 02 of
typeLOADextends from 0x08048000 to0x8048000 + 0x0046d = 0x0804846d. It contains
the.note.ABI-tagsegment. However, the same area in virtual address space is
used to implement segment 06 (of theNOTEtype) that extends from0x08048108to
0x08048108 + 0x00020 = 0x08048128and therefore lieswithinsegment 02. This
behavior is explicitly allowed by the standard.

E.1.3 Sections


The contents of segments are described by specifying the sections whose data are to be copied into the
segments. A further table known as asection header tableis used to manage the sections of a file, as shown
in Figure E-1. Again,readelfcan be used to display the sections of a file, like this:

wolfgang@meitner>readelf -S test.o
There are 10 section headers, starting at offset 0x114:

Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS 00000000 000034 000065 00 AX 0 0 4
[ 2] .rel.text REL 00000000 000374 000030 08 8 1 4

(^4) IA-64 usesregister stacksto store the local variables of a procedure. The processor automatically reserves a window in the compre-
hensive processor register set for this purpose. Depending on requirements, parts of these registers can be swapped out into memory
transparently to the program. Because the size of the register stacks is different for each procedure and different registers may be
swapped out depending on the call chain, a backtrace can no longer be generated by simply running backward through the stack
frames by means of the frame pointers, as is possible in most otherarchitectures. IA-64 machines require the saved unwind infor-
mation.

Free download pdf