+-----------------------------+
|         ELF Header          |
|  (Elf32_Ehdr / Elf64_Ehdr)   |
+-----------------------------+
|      |                  |
|      V                  V
+-----------------------------+    +----------------------------+
|    Program Header Table    |----| Program Segment 1 (PT_LOAD) |
|  (Array of Elf32_Phdr/    |    +----------------------------+
|  Elf64_Phdr structures)   |----| Program Segment 2 (PT_LOAD) |
+-----------------------------+    +----------------------------+
|      |                  |  ... | Program Segment ...         |
|      V                  V      +----------------------------+
+-----------------------------+    +----------------------------+
|      Section 1  (.text)   |----|  .text Section Data         |
+-----------------------------+    +----------------------------+
|      Section 2  (.data)   |----|  .data Section Data         |
+-----------------------------+    +----------------------------+
|      Section 3  (.bss)    |----|  (No Data in File, Memory  )|
+-----------------------------+    |  Allocation at Runtime)   |
|      Section 4  (.rodata)  |----|  .rodata Section Data        |
+-----------------------------+    +----------------------------+
|      Section 5  (.symtab)  |----|  .symtab Section Data        |
+-----------------------------+    +----------------------------+
|      Section 6  (.strtab)  |----|  .strtab Section Data       |
+-----------------------------+    +----------------------------+
|      ...                   | ... |  ...                      |
+-----------------------------+    +----------------------------+
|    Section Header Table     |     (Section Header Table Entries)|
|  (Array of Elf32_Shdr /     |     (Elf32_Shdr / Elf64_Shdr    )|
|  Elf64_Shdr structures)    |     (Point to corresponding Section)
+-----------------------------+
+---------------------------+
| ELF Header                |  <-- Magic Number, Type, Entry Point, etc.
+---------------------------+
| Program Header Table      |  <-- Describes memory layout for execution
+---------------------------+
| Section Header Table      |  <-- Describes sections like .text, .data, etc.
+---------------------------+
| Section 1: .text          |  <-- Code segment
+---------------------------+
| Section 2: .data          |  <-- Initialized data segment
+---------------------------+
| Section 3: .bss           |  <-- Uninitialized data segment
+---------------------------+
| Section n: .symtab        |  <-- Symbol table (for linking)
+---------------------------+
| Section n+1: .strtab      |  <-- String table (for symbol names)
+---------------------------+
| (Optional) Debug Sections |  <-- Debugging info (.debug, .line, etc.)
+---------------------------+

推荐阅读: