# Executable

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Executable
> Markdown URL: https://mediated.wiki/source/Executable.md
> Source: https://en.wikipedia.org/wiki/Executable
> Source revision: 1354604554
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

Data that causes a computer to follow indicated instructions

This article is about a general type of data. For the specific file type used in some operating systems, see [.exe](/source/.exe).

Program execution General concepts Code Translation Compiler Compile time Optimizing compiler Linking Execution Runtime system Executable Interpreter Virtual machine Intermediate representation (IR) Types of code Source code Object code Bytecode Machine code Microcode Compilation strategies Ahead-of-time (AOT) Just-in-time (JIT) Tracing just-in-time Compile and go system Precompilation Transcompilation Recompilation Meta-tracing Notable runtimes Android Runtime (ART) BEAM (Erlang) Common Language Runtime (CLR) and Mono CPython and PyPy crt0 (C target-specific initializer) Java virtual machine (JVM) LuaJIT Objective-C and Swift's V8 and Node.js Zend Engine (PHP) Notable compilers & toolchains GNU Compiler Collection (GCC) LLVM and Clang MSVC Glasgow Haskell Compiler (GHC) v t e

A [hex dump](/source/Hex_dump) of an executable [real mode](/source/Real_mode) loader. The first column consists of [addresses](/source/Byte_address) of the first byte in the second column, which comprises bytes of data in [hexadecimal](/source/Hexadecimal) notation ([least significant byte](/source/Bit_numbering#Bit_significance_and_indexing) first), and the last column consists of the corresponding [ASCII](/source/ASCII) form.[1]

[Hexadecimal](/source/Hexadecimal) representation of a binary executable file

In [computing](/source/Computing), an **executable** is a [resource](/source/Computer_resource) that a [computer](/source/Computer) can use to control its behavior. As with all information in computing, it is [data](/source/Data), but distinct from data that does not imply a [flow of control](/source/Control_flow).[2] Terms such as **executable code**, **executable file**, **executable program**, and **executable image** describe forms in which the information is represented and stored. A **native executable** is [machine code](/source/Machine_code) and is directly executable at the [instruction level](/source/Instruction_(computer_science)) of a [CPU](/source/Central_processing_unit).[3][4] A [script](/source/Script_(computer_programming)) is also executable although indirectly via an [interpreter](/source/Interpreter_(computing)). Intermediate executable code (such as [bytecode](/source/Bytecode)) may be interpreted or converted to native code at runtime via [just-in-time compilation](/source/Just-in-time_compilation).

## Native executable

Even though it is technically possible to write a native executable directly in machine language, it is generally not done. It is far more convenient to develop software as [human readable](/source/Human_readable) [source code](/source/Source_code) and to automate the generation of machine code via a [build](/source/Software_build) [toolchain](/source/Toolchain). Today, most source code is a [high-level language](/source/High-level_language) although it is still possible to use [assembly language](/source/Assembly_language) which is closely associated with machine code instructions. Many toolchains consist of a [compiler](/source/Compiler) that generates native code as a set of [object files](/source/Object_file) and a [linker](/source/Linker_(computing)) that generates a native executable from the object and other files. For assembly language, typically the translation tool is called an [assembler](/source/Assembler_(computing)) instead of a compiler.

Object files are typically stored in a [digital container format](/source/Digital_container_format) that supports structure in the machine code – such as [Executable and Linkable Format](/source/Executable_and_Linkable_Format) (ELF) or [Portable Executable](/source/Portable_Executable) (PE), depending on the computing context.[5] The format may support segregating code into sections such as [.text](/source/.text) (executable code), [.data](/source/.data) (initialized global and static variables), and [.rodata](/source/.rodata) (read-only data, such as constants and strings).

Executable files typically include a [runtime system](/source/Runtime_system), which implements runtime language features (such as [task scheduling](/source/Task_scheduling), [exception handling](/source/Exception_handling), calling static constructors and destructors, etc.) and interactions with the operating system, notably passing arguments, environment, and returning an [exit status](/source/Exit_status), together with other startup and shutdown features such as releasing resources like [file handles](/source/File_handle). For C, this is done by linking in the [crt0](/source/Crt0) object, which contains the actual entry point and does setup and shutdown by calling the [runtime library](/source/Runtime_library).[6] Executable files thus may contain significant code beyond that directly generated from the source code. In some cases, it is desirable to omit this, for example for embedded systems. In C, this can be done by omitting the usual runtime, and instead explicitly specifying a linker script, which generates the entry point and handles startup and shutdown, such as calling main to start and returning exit status to the kernel at the end.[7]

To be executable, a file must conform to the system's [application binary interface](/source/Application_binary_interface) (ABI). In simple interfaces, a file is executed by loading it into memory and jumping to the start of the address space and executing from there.[8] In more complicated interfaces, executable files have additional [metadata](/source/Metadata), which may specify [relocations](/source/Relocation_(computing)) to be performed when the program is loaded, or the [entry point](/source/Entry_point) address at which to start execution.[9]

## See also

- [Comparison of executable file formats](/source/Comparison_of_executable_file_formats)

- [Executable compression](/source/Executable_compression) – Means of compressing an executable file

- [Executable text](/source/Executable_text) – Code intended as a payload to exploit a software vulnerabilityPages displaying short descriptions of redirect targets

- [Object file](/source/Object_file) – File containing relocatable format machine code

## References

1. **[^](#cite_ref-Celovi_2022_1-0)** Celovi, Paul (2002). [*Embedded FreeBSD Cookbook*](https://books.google.com/books?id=E4SFkfsOVaoC&pg=PA188). [Elsevier](/source/Elsevier). pp. 108, 187–188. [ISBN](/source/ISBN_(identifier)) [1-5899-5004-6](https://en.wikipedia.org/wiki/Special:BookSources/1-5899-5004-6). Retrieved 2022-03-06.

1. **[^](#cite_ref-Mueller_2007_2-0)** Mueller, John Paul (2007). [*Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000*](https://books.google.com/books?id=Ua819DVKQPwC&pg=PA24). [John Wiley & Sons](/source/John_Wiley_%26_Sons). p. 24. [ISBN](/source/ISBN_(identifier)) [978-0-470-04616-6](https://en.wikipedia.org/wiki/Special:BookSources/978-0-470-04616-6). Retrieved 2023-03-06.

1. **[^](#cite_ref-MW_2008_3-0)** ["executable"](http://www.merriam-webster.com/dictionary/executable). *Merriam-Webster's Online Dictionary*. [Merriam-Webster](/source/Merriam-Webster). Retrieved 2008-07-19.

1. **[^](#cite_ref-GFG_2015_4-0)** ["Machine Instructions"](https://www.geeksforgeeks.org/machine-instructions/). *GeeksforGeeks*. 2015-11-03. Retrieved 2019-09-18.

1. **[^](#cite_ref-LB_2019_5-0)** ["Chapter 4: Object Files"](https://refspecs.linuxbase.org/elf/gabi4+/ch4.intro.html). *refspecs.linuxbase.org*. Retrieved 2019-09-18.

1. **[^](#cite_ref-Fisher_2019_6-0)** Fisher, Tim. ["List of Executable File Extensions"](https://www.lifewire.com/list-of-executable-file-extensions-2626061). *lifewire.com*. Retrieved 2019-09-18.

1. **[^](#cite_ref-McKellar_2010_7-0)** McKellar, Jessica (2010-03-16). ["Hello from a libc-free world! (Part 1)"](https://blogs.oracle.com/ksplice/entry/hello_from_a_libc_free).

1. **[^](#cite_ref-Computer_2005_8-0)** [Smith, James E.](/source/James_E._Smith_(engineer)); Nair, Ravi (2005-05-16). ["The Architecture of Virtual Machines"](http://digital.library.wisc.edu/1793/11154). *[Computer](/source/Computer_(magazine))*. **38** (5): 33–34. [doi](/source/Doi_(identifier)):[10.1109/MC.2005.173](https://doi.org/10.1109%2FMC.2005.173).

1. **[^](#cite_ref-Rusling_1999_9-0)** Rusling, David A. (1999). ["Chapter 4 – Processes"](https://tldp.org/LDP/tlk/kernel/processes.html). *The Linux Kernel*. sec. 4.8.1 – ELF. Retrieved 2023-03-06.

## External links

- [EXE File Format](http://whatis.techtarget.com/fileformat/EXE-Executable-file-program) at What Is

v t e Executable and object file formats a.out AIF COFF CMD COM ECOFF ELF GOFF Hunk Mach-O MZ NE OMF OS/360 PE PEF X XCOFF Comparison of formats .exe

---
Adapted from the Wikipedia article [Executable](https://en.wikipedia.org/wiki/Executable) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Executable?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
