Linkers, Loaders & Executables

What is in the .text section of an executable?

  1. AThe program's machine instructions
  2. BThe text files the program uses
  3. CStrings typed in while it runs
Show answer and explanation

Answer: A. The program's machine instructions

The .text section contains the machine instructions translated from the functions. At run time it is normally readable and executable but not writable, which guards against stray writes and attackers rewriting code. And because it never changes, when several processes run the same program or shared library they can share a single copy in physical memory.

  • A. Correct. Despite the name, it holds code, not text.
  • B. Despite the name, it holds machine code.
  • C. Input goes into run-time areas such as the heap or stack.
Practice this topic Back to topic

More Linkers, Loaders & Executables questions

  1. In C, a global variable written outside any function as "int limit = 100;" is generally placed in which section?
  2. What is a characteristic of the .bss section?
  3. Running C code "char *p = "hello"; p[0] = 'H';" crashes in many environments. Why?
  4. Of the global variables above, which are generally placed in the .bss section?
  5. Where is a non-static local (automatic) variable declared inside a C function placed at run time?