Executable

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.

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

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 of an executable real mode loader. The first column consists of addresses of the first byte in the second column, which comprises bytes of data in hexadecimal notation (least significant byte first), and the last column consists of the corresponding ASCII form.[1]

In computing, an executable is a resource that a computer can use to control its behavior. As with all information in computing, it is data, but distinct from data that does not imply a flow of control.[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 and is directly executable at the instruction level of a CPU.[3][4] A script is also executable although indirectly via an interpreter. Intermediate executable code (such as bytecode) may be interpreted or converted to native code at runtime via just-in-time compilation.

## Native executable

[edit]

Even though it's 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 code and to automate the generation of machine code via a build toolchain. Today, most source code is a high-level language although it's still possible to use assembly language which is closely associated with machine code instructions. Many toolchains consist of a compiler that generates native code as a set of object files and a linker that generates a native executable from the object and other files. For assembly language, typically the translation tool is called an assembler instead of a compiler.

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

Executable files typically include a runtime system, which implements runtime language features (such as task scheduling, exception handling, calling static constructors and destructors, etc.) and interactions with the operating system, notably passing arguments, environment, and returning an exit status, together with other startup and shutdown features such as releasing resources like file handles. For C, this is done by linking in the crt0 object, which contains the actual entry point and does setup and shutdown by calling the 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 (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, which may specify relocations to be performed when the program is loaded, or the entry point address at which to start execution.[9]

## See also

[edit]

* Comparison of executable file formats
* Executable compression – Means of compressing an executable file
* Executable text – Code intended as a payload to exploit a software vulnerabilityPages displaying short descriptions of redirect targets
* Object file – File containing relocatable format machine code

## References

[edit]

1. ^ Celovi, Paul (2002). Embedded FreeBSD Cookbook. Elsevier. pp. 108, 187–188\. ISBN 1-5899-5004-6. Retrieved 2022-03-06.
2. ^ Mueller, John Paul (2007). Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000. John Wiley & Sons. p. 24\. ISBN 978-0-470-04616-6. Retrieved 2023-03-06.
3. ^ "executable". Merriam-Webster's Online Dictionary. Merriam-Webster. Retrieved 2008-07-19.
4. ^ "Machine Instructions". GeeksforGeeks. 2015-11-03. Retrieved 2019-09-18.
5. ^ "Chapter 4: Object Files". refspecs.linuxbase.org. Retrieved 2019-09-18.
6. ^ Fisher, Tim. "List of Executable File Extensions". lifewire.com. Retrieved 2019-09-18.
7. ^ McKellar, Jessica (2010-03-16). "Hello from a libc-free world! (Part 1)".
8. ^ Smith, James E.; Nair, Ravi (2005-05-16). "The Architecture of Virtual Machines". Computer. 38 (5): 33–34\. doi:10.1109/MC.2005.173.
9. ^ Rusling, David A. (1999). "Chapter 4 – Processes". The Linux Kernel. sec. 4.8.1 – ELF. Retrieved 2023-03-06.

## External links

[edit]

* EXE File Format 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

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template