Hand-Held Devices and Embedded Systems Course Student: Tomás Sánchez López Student ID: 20042116.

Slides:



Advertisements
Similar presentations
Programs in Memory Bryce Boe 2012/08/29 CS32, Summer 2012 B.
Advertisements

Chapter 10 Linking and Loading. Separate assembly creates “.mob” files.
MIPS ISA-II: Procedure Calls & Program Assembly. (2) Module Outline Review ISA and understand instruction encodings Arithmetic and Logical Instructions.
Fabián E. Bustamante, Spring 2007 Linking Today Static linking Object files Static & dynamically linked libraries Next time Exceptional control flows.
MIPS ISA-II: Procedure Calls & Program Assembly. (2) Module Outline Review ISA and understand instruction encodings Arithmetic and Logical Instructions.
Program Development Tools The GNU (GNU’s Not Unix) Toolchain The GNU toolchain has played a vital role in the development of the Linux kernel, BSD, and.
Assembler/Linker/Loader Mooly Sagiv html:// Chapter 4.3 J. Levine: Linkers & Loaders
Chapter 3 Loaders and Linkers
3. Loaders & Linkers1 Chapter III: Loaders and Linkers Chapter goal: r To realize how a source program be loaded into memory m Loading m Relocation m Linking.
Chapter 3 Loaders and Linkers
Loaders and Linkers CS 230 이준원. 2 Overview assembler –generates an object code in a predefined format »COFF (common object file format) »ELF (executable.
Lecture 10: Linking and loading. Lecture 10 / Page 2AE4B33OSS 2011 Contents Linker vs. loader Linking the executable Libraries Loading executable ELF.
Mr. D. J. Patel, AITS, Rajkot 1 Operating Systems, by Dhananjay Dhamdhere1 Static and Dynamic Memory Allocation Memory allocation is an aspect of a more.
Linkers and Loaders 1 Linkers & Loaders – A Programmers Perspective.
Binary Loader What is done by binary loader? ● Read executable from the filesystem ● Parse the binary header ● Copy all segments into addresses specified.
CS 31003: Compilers ANIRUDDHA GUPTA 11CS10004 G2 CLASS DATE : 24/07/2013.
Computer Organization CS224 Fall 2012 Lesson 12. Synchronization  Two processors or threads sharing an area of memory l P1 writes, then P2 reads l Data.
1 Starting a Program The 4 stages that take a C++ program (or any high-level programming language) and execute it in internal memory are: Compiler - C++
Compilation (Semester A, 2013/14) Lecture 13: Assembler, Linker & Loader Noam Rinetzky Slides credit: Eli Bendersky, Mooly Sagiv & Sanjeev Setia.
Linking and Loading Fred Prussack CS 518. L&L: Overview Wake-up Questions Terms and Definitions / General Information LoadingLinking –Static vs. Dynamic.
An introduction to systems programming
UEE072HM Embedded Control Systems. Breaking down the compilation process Compilation is made up of a number of phases –Preprocessing –Compilation Can.
1 RISE: Randomization Techniques for Software Security Dawn Song CMU Joint work with Monica Chew (UC Berkeley)
Software Development and Software Loading in Embedded Systems.
1 uClinux course Day 3 of 5 The uclinux toolchain, elf format and ripping a “hello world”
OBJECT MODULE FORMATS. The object module format we have employed as an educational device is called OMF (relocatable object format). It’s one of the earliest.
Operating System Chapter 7. Memory Management Lynn Choi School of Electrical Engineering.
Enabling the ARM Learning in INDIA ARM DEVELOPMENT TOOL SETUP.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 8: Main Memory.
MIPS coding. SPIM Some links can be found such as:
Topic 2d High-Level languages and Systems Software
CSE451 Linking and Loading Autumn 2002 Gary Kimura Lecture #21 December 9, 2002.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Memory: Relocation.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /29/2013 Lecture 13: Compile-Link-Load Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
CS412/413 Introduction to Compilers and Translators April 14, 1999 Lecture 29: Linking and loading.
1 CS503: Operating Systems Spring 2014 Part 0: Program Structure Dongyan Xu Department of Computer Science Purdue University.
Paradyn Project Paradyn / Dyninst Week Madison, Wisconsin April 12-14, 2010 Binary Rewriting with Dyninst Madhavi Krishnan and Dan McNulty.
Different Types of Libraries
Week 4 - Friday.  What did we talk about last time?  Some extra systems programming stuff  Scope.
CSc 453 Linking and Loading
Linking I Topics Assembly and symbol resolution Static linking Systems I.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Hello world !!! ASCII representation of hello.c.
CC410: System Programming Dr. Manal Helal – Fall 2014 – Lecture 10 – Loaders.
Program Execution and ELF Files Extended System Programming Laboratory (ESPL) CS BGU Fall 2013/2014 Abed Asi.
Object Files & Linking. Object Sections Compiled code store as object files – Linux : ELF : Extensible Linking Format – Windows : PE : Portable Execution.
Program Execution in Linux David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Lecture 3 Translation.
Assemblers, linkers, loaders
Slides adapted from Bryant and O’Hallaron
Tools of the Trade
System Programming and administration
The University of Adelaide, School of Computer Science
Linking & Loading.
Linux Userspace Process Memory Layout
Chapter 8 Main Memory.
Program Execution in Linux
Software Development with uMPS
Topic 2e High-Level languages and Systems Software
Loaders and Linkers: Features
Loaders and Linkers.
Memory Allocation CS 217.
Linking.
Operating System Chapter 7. Memory Management
Embedded System Development Lecture 13 4/11/2007
Program Execution in Linux
Loaders and Linkers.
An introduction to systems programming
Program Assembly.
Presentation transcript:

Hand-Held Devices and Embedded Systems Course Student: Tomás Sánchez López Student ID:

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

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. What is ELF?

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 Basics

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 Executables

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

Executables Elf Header describes the files 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 filess sections Relocatable files have section headers tables. Executable files have program headers tables. Shared object files have both.

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)

Linking View Important Sections:.interpPath name of program interpreter (Dynamic linker).textCode (executable instructions) of a program.dataInitialized data.bssUninitilized data.initExecutable instruction for process initilization.finiExecutalbe intructions for process termination.ptlHolds the procedure linkage table.re. Relocation information for section.dynamicDynamic linking information

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

Execution View Segment Types: LOADPortion of file to be loaded into memory INTERPPointer to dynamic linker for this executable (.interp section) DYNAMICPointer to dynamic linking information (.dynamic section)

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

Example System Code System Data main () int x = 5 funtion () int v = 10 int u = 32 int y Relocatable Object files Headers System code main () a () System Code System Data int x = 5 int v = 10 int u = 32 Uninitialized data others.text.data.bss

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

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

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

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

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

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