HOME

TheInfoList




In
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and software. It has sci ...

computing
, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instructions", as opposed to a
data file A data file is a computer file A computer file is a computer resource for recording data Data are units of information Information can be thought of as the resolution of uncertainty; it answers the question of "What an entity is" and ...
that must be interpreted () by a program to be meaningful. The exact interpretation depends upon the use. "Instructions" is traditionally taken to mean
machine code In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ge ...
instructions for a physical
CPU A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuit File:PExdcr01CJC.jpg, 200px, A circuit built on a printed circuit board (PCB). An electronic circuit is composed of ...

CPU
. In some contexts, a file containing scripting instructions (such as
bytecode Bytecode, also termed portable code or p-code, is a form of instruction set In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions ...
) may also be considered executable.


Generation of executable files

Executable files can be hand-coded in machine language, although it is far more convenient to develop software as
source code In , source code is any collection of code, with or without , written using a ''human-readable'' , usually as . The source code of a program is specially designed to facilitate the work of computer s, who specify the actions to be performed ...

source code
in a
high-level language In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
that can be easily understood by humans. In some cases, source code might be specified in
assembly language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, gene ...
instead, which remains human-readable while being closely associated with machine code instructions. The high-level language is
compiled In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily ...

compiled
into either an executable machine code file or a non-executable machine code –
object file An object file is a computer file containing object code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and ...
of some sort; the equivalent process on assembly language source code is called ''assembly''. Several object files are linked to create the executable. Object files -- executable or not -- are typically stored in a container format, such as
Executable and Linkable Format In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and soft ...
(ELF) or
Portable Executable The Portable Executable (PE) format is a file format A file format is a standard Standard may refer to: Flags * Colours, standards and guidons * Standard (flag), a type of flag used for personal identification Norm, convention or re ...
(PE) which is
operating system An operating system (OS) is system software System software is software designed to provide a platform for other software. Examples of system software include operating systems (OS) like macOS, Linux, Android (operating system), Android and Mi ...

operating system
-specific. This gives structure to the generated machine code, for example dividing it 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 also include a
runtime system In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a specific task. Programming involves tasks such as: analysis, gener ...
, which implements runtime language features (such as
task schedulingIn computing, scheduling is the method by which work is assigned to resources that complete the work. The work may be virtual computation elements such as thread (computer science), threads, process (computing), processes or data flow (computer netw ...
,
exception handling In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithm of an algorithm (Euclid's algorithm) for calculating the greatest commo ...
, calling static constructors and destructors, etc.) and interactions with the operating system, notably passing arguments, environment, and returning an
exit status The exit status of a process A process is a series or set of Action (philosophy), activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management *Busi ...
, together with other startup and shutdown features such as releasing resources like
file handle In Unix and Unix-like computer operating systems, a file descriptor (FD, less frequently fildes) is a unique identifier (Handle (computing), handle) for a file (computing), file or other input/output System resource, resource, such as a pipe (Unix), ...
s. For C, this is done by linking in the
crt0 (also known as ) is a set of execution startup routines linked into a C program that performs any initialization work required before calling the program's main function In computer programming, an entry point is where the first instruction ...
object, which contains the actual entry point and does setup and shutdown by calling the
runtime library In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a specific task. Programming involves tasks such as: analysis, genera ...
. Executable files thus normally contain significant additional machine code beyond that directly generated from the specific source code. In some cases, it is desirable to omit this, for example for embedded systems development, or simply to understand how compilation, linking, and loading work. 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.


Execution

In order to be executed by the system (such as an operating system,
firmware In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and soft ...
, or
boot loader A bootloader is software that is responsible for booting In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithm of an al ...
), an executable file must conform to the system's
application binary interface In computer software Software is a collection of instructions Instruction or instructions may refer to: Computing * Instruction, one operation of a processor within a computer architecture instruction set * Computer program, a collection ...
(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. In more complicated interfaces, executable files have additional metadata specifying a separate
entry point In computer programming Computer programming is the process of designing and building an executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, cau ...

entry point
. For example, in ELF, the entry point is specified in the header's e_entry field, which specifies the (virtual) memory address at which to start execution. In the GCC (
GNU Compiler Collection The GNU Compiler Collection (GCC) is an optimizing compiler In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithm of an ...
) this field is set by the linker based on the _start symbol.


See also

*
Comparison of executable file formats This is a comparison of binary executable In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development ...
*
Executable compression Executable compression is any means of compressing an executable In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmi ...
* Executable text


References


External links


EXE File Format
at What Is {{Executables Computer file systems Programming language implementation