Thread: Question Regarding ELF

  1. #1
    Registered User
    Join Date
    Feb 2018
    Posts
    1

    Question Regarding ELF

    Hi all,
    as far as I know my gcc compiler (I'm using Linux) compiles my C code into ELF code, which is not 'real' machine readable code. Is this correct?

    If so, it must be translated some how into assembler. Is there an interpreter working while running the program?
    Thank you!

  2. #2
    Registered User
    Join Date
    Dec 2017
    Posts
    1,633
    It's an ELF file, not ELF code. It's divided into sections with headers, but the actual machine code is stored as is except for some addresses which need to be calculated to resolve links to external objects and function calls (and possibly for relocation).
    Executable and Linkable Format
    Last edited by john.c; 02-21-2018 at 10:25 AM.
    A little inaccuracy saves tons of explanation. - H.H. Munro

  3. #3
    Registered User Sir Galahad's Avatar
    Join Date
    Nov 2016
    Location
    The Round Table
    Posts
    277
    Quote Originally Posted by pacman View Post
    Hi all, as far as I know my gcc compiler (I'm using Linux) compiles my C code into ELF code, which is not 'real' machine readable code. Is this correct? If so, it must be translated some how into assembler. Is there an interpreter working while running the program? Thank you!
    Modern operating systems utilize file formats like ELF and PE primarily because they provide a means of importing and exporting routines (functions). Some files are essentially libraries of code while others are the programs we compile. Both will typically import external procedures but only libraries actually export anything. Programs are flagged executable and are run as individual instances whereas libraries are loaded into memory until their reference count reaches zero (and thus have a natural persistence across application boundaries).

    The code within all these files is usually just raw machine code that can execute directly on the CPU. The Android family of operating systems run Java bytecode stored in APK files inside a virtual machine (interpreter) but even that platform sometimes uses "just in time" (JIT) compilation to convert to native instructions beforehand.
    Last edited by Sir Galahad; 02-21-2018 at 11:14 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 08-25-2014, 05:41 PM
  2. Replies: 1
    Last Post: 03-23-2011, 09:00 AM
  3. *szString = things question/memory question
    By Jang in forum C Programming
    Replies: 3
    Last Post: 01-20-2011, 04:59 AM
  4. Newbish Question file reading question....
    By kas2002 in forum C Programming
    Replies: 23
    Last Post: 05-17-2007, 12:06 PM
  5. Self regiserting DLLs question and libraries question.
    By ApocalypticTime in forum Windows Programming
    Replies: 2
    Last Post: 03-22-2003, 02:02 PM

Tags for this Thread