Linkers, Loaders & Executables
Which pairs major operating systems with the executable formats they use correctly?
- ALinux uses PE, Windows uses Mach-O and macOS uses ELF
- BLinux uses ELF, Windows uses PE and macOS uses Mach-O
- CEvery OS uses ELF
Show answer and explanation
Answer: B. Linux uses ELF, Windows uses PE and macOS uses Mach-O
Each OS defines its executable format: Linux, BSD and many embedded devices use ELF, Windows uses PE (Portable Executable) for .exe and .dll files, and macOS and iOS use Mach-O. The underlying ideas (code and data areas, symbols, relocations, dynamic-linking information) are similar, but because the formats differ, an executable does not run unchanged on a different OS even for the same CPU.
- A. The pairs are scrambled.
- B. Correct. Each OS has its own format.
- C. Windows and macOS use different formats.