Linkers, Loaders & Executables

Which statement is correct about files in the ELF format commonly used on Linux and similar systems?

  1. AIt is only for executables and cannot be used for object files
  2. BIt is used for object files, executables and shared libraries alike, and consists of a header, sections and so on
  3. CIt is a format for storing images
Show answer and explanation

Answer: B. It is used for object files, executables and shared libraries alike, and consists of a header, sections and so on

ELF (Executable and Linkable Format) is the program file format used by Linux, many other UNIX-like systems and embedded devices. The ELF header at the start records the target CPU, whether it is 64-bit, the address where execution starts and more, followed by sections such as .text and .data and program headers describing what the loader maps into memory. Windows uses the PE format and macOS uses Mach-O.

  • A. Object files and shared libraries are also ELF.
  • B. Correct. It stands for Executable and Linkable Format.
  • C. It is a format for programs.
Practice this topic Back to topic

More Linkers, Loaders & Executables questions

  1. What is in the .text section of an executable?
  2. In C, a global variable written outside any function as "int limit = 100;" is generally placed in which section?
  3. What is a characteristic of the .bss section?
  4. Running C code "char *p = "hello"; p[0] = 'H';" crashes in many environments. Why?
  5. Of the global variables above, which are generally placed in the .bss section?