1 / 19

Executable and Linkable Format

Hand-Held Devices and Embedded Systems Course. E. F. Executable and Linkable Format. Student: Tom ás Sánchez López Student ID: 20042116. Outline. What is ELF Basics Executables Linking View Execution View Example Loading and Executing and ELF executable Various

derica
Download Presentation

Executable and Linkable Format

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Hand-Held Devices and Embedded Systems Course E F Executable and Linkable Format Student: Tomás Sánchez López Student ID: 20042116

  2. Outline • What is ELF • Basics • Executables • Linking View • Execution View • Example • Loading and Executing and ELF executable • Various • Conclusions

  3. What is ELF? • Stands for Executable and Linking Format • Standarized executable file format used in most Unix sytems • Subsitute of traditional a.out due to efficiency issues (i.e dynamic linking) • Developed originally in Unix Systems Laboratory (USL) and adopted by The Tool Interface Standard (TIS) committe.

  4. Basics • Three main types of ELF object files • Relocatable files: code and data to be linked with other object files • Executable files • Shared object files: Libraries • Object file: binary representation of programs intended to execute directly on a processor

  5. Executables • Static vs Dynamic Executables • Static: Self contained. Too large files due to static inclussion of library code • Dynamic: Using external code or data at run time. More convinient • Two views of executables according to their participation: • Linking view: Executable participation in program linking • Execution view: Executable participation in program execution

  6. Executables • Link View: Used at static linking time for relocatable file combination • Execution View: Used at run time to load and execute programs

  7. Executables • Elf Header describes the file’s organization and resides always at the beginning • Program Header Table, if present, tells the system how to create a process image • Section Header Table, if present, contains information describing the files’s sections • Relocatable files have section headers tables. • Executable files have program headers tables. • Shared object files have both.

  8. Linking View • Divides the object files into a collection of sections • Sections have : • Name and type • Requested memory ocation at run time • Permissions • Each section contains a single type of information and can contain flags (writable data, memory space during execution or executable machine instructions)

  9. Linking View • Important Sections:

  10. Execution View • Simpler view that divides the object file into segments • Segments have: • Simple type • Requested memory location • Permissions • Size (in file and in memory) • All loadable sections are packed into segments so that file mapping is easier

  11. Execution View • Segment Types:

  12. int x = 5; int main() { int r = x +funtion (); exit (0); } Relocatable file 1 int v = 10; int u = 32; int z; int function() { return v+u; } Relocatable file 2 Example

  13. Example Relocatable Object files .text .data .bss

  14. Loading and Executing and ELF Executable • Open the file • Map LOAD segments into memory • Call the dynamic linker specified in the INTERP segment, passing information about the executable • Handles all the dynamic/shared library needs of the executable • Retrieves information from the DYNAMIC segment • Loads all required libraries into memory • Modifies executable so it can access needed resources in the libraries

  15. Load and Executing and ELF Executable • Basically: Relocatable File 1 Relocatable File N Static Linking Executable Object File Shared Libraries Dynamic Linker Executing …

  16. Various • Shared Libraries • Need to be compiled memory position independent (PIC) • Uses a Global Offset table (GOT) with pointers to variables created at compile and linking time • Uses the Procedure Linkage Table (PLT) for procedure library calling • Implies some performance disadvantages

  17. Various • Others • Relocations tell dynamic linker to rewrite parts of the excutable to refer to external resources • Exists a dynamic debugging structure offering information about process memory layout and binaries loaded

  18. Conclusions • Logical evolution of old executable formats • Convinient double view depending for linking and executing time • Great support for dynamic linking, cross-compilation and others • Convinient separation between file types depending on its function • Standard and defined functionality for nowadays executable file needs in diferent platforms

  19. References • For an exhaustive review of ELF specification please refer to: • Executable and Linkable Format (ELF)Tool Interface Standards (TIS), Portable Formats Specification, Version 1.1

More Related