Revision as of 21:53, 27 May 2003 editTarquin (talk | contribs)14,993 editsmNo edit summary← Previous edit | Latest revision as of 17:49, 14 October 2024 edit undoCitation bot (talk | contribs)Bots5,436,053 edits Add: url, journal. Removed parameters. Some additions/deletions were parameter name changes. | Use this bot. Report bugs. | Suggested by Dominic3203 | Category:Programming language implementation | #UCB_Category 30/50 | ||
(356 intermediate revisions by more than 100 users not shown) | |||
Line 1: | Line 1: | ||
{{Short description|A file that causes a computer to follow indicated instructions}} | |||
An ''executable'' or ''executable file'', in ], is a ] whose contents are meant to be interpreted as a ] by a ]. | |||
{{About|a general type of computer file|the specific file type used in some operating systems|.exe}} | |||
{{Use dmy dates|date=December 2021|cs1-dates=y}} | |||
{{Use list-defined references|date=December 2021}} | |||
{{Program execution}} | |||
] of an executable ] loader. The first column consists of ]es of the first byte in the second column, which comprises bytes of data in ] notation (] first), and the last column consists of the corresponding ] form.<ref name="Celovi_2022"/>]] | |||
In ], '''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 ]s",<ref name="MW_2008"/> as opposed to a ] that must be interpreted (]) by an ] to be functional.<ref name="Mueller_2007" /> | |||
Most often, they contain the binary representation of machine instructions of a specific ], but can also contain and intermediate form that will require the services of an ] to be run. | |||
The exact interpretation depends upon the use. "Instructions" is traditionally taken to mean ] instructions for a physical ].<ref name="GFG_2015"/> In some contexts, a file containing scripting instructions (such as ]) may also be considered executable. | |||
Whether a file is an executable or not is mostly a matter of convention; some ] designate executable files by specific naming convention (such as the name ending in a ] ".exe") or noted alongside the file in its meta-information (such as the execute permission bits under ]-like operating systems). | |||
==Generation of executable files== | |||
On most modern architectures, an executable file contains much information which is not part of the program itself, such as information on the environment required to run the program, debugging and symbolic information, or other housekeeping information used by the operating system to prepare the program to be run. | |||
{{See also|Object file}} | |||
Executable files can be hand-coded in machine language, although it is far more convenient to develop software as ] in a ] that can be easily understood by humans. In some cases, source code might be specified in ] instead, which remains human-readable while being closely associated with machine code instructions. | |||
Nowadays, the distinction between a program in ] form (ultimately meant to be human readable) and in executable form (ultimately meant to be machine readable) is getting less distinct since the act of transforming the former into the latter (by ]) or interpreting it may be performed implicitely. | |||
The high-level language is ] into either an executable machine code file or a non-executable machine code – ] of some sort; the equivalent process on assembly language source code is called ''assembly''. Several object files are ] to create the executable. Object files -- executable or not -- are typically stored in a ], such as ] (ELF) or ] (PE) which is ]-specific.<ref name="LB_2019"/> This gives structure to the generated machine code, for example dividing it into sections such as ] (executable code), ] (initialized global and static variables), and ] (read-only data, such as constants and strings). | |||
Thus, the meaning for the term executable has been usualy extended from a file containing machine instruction to any file that can ultimately be executed by the environment without requiring an explicit transformation. | |||
Executable files typically also include a ], which implements runtime language features (such as ], ], calling static constructors and destructors, etc.) and interactions with the operating system, notably passing arguments, environment, and returning an ], together with other startup and shutdown features such as releasing resources like ]s. For C, this is done by linking in the ] object, which contains the actual entry point and does setup and shutdown by calling the ].<ref name="Fisher_2019"/> | |||
Files containing ], however, are usually named script files or scripts rather than executables. | |||
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 <code>main</code> to start and returning exit status to the kernel at the end.<ref name="McKellar_2010"/> | |||
== Execution == | |||
In order to be executed by the system (such as an ], {{citation needed span|]|date=March 2023}}, or ]), an executable file must conform to the system's ] (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.<ref name="Computer_2005"/> In more complicated interfaces, executable files have additional metadata specifying a separate ]. For example, in ELF, the entry point is defined in the header's <code>e_entry</code> field, which specifies the (virtual) memory address at which to start execution.<ref name="Rusling_1999"/> In the ], this field is set by the linker based on the <code>_start</code> symbol.<ref name="Page_2009"/> | |||
==See also== | |||
* ] | |||
* ] | |||
* ] | |||
==References== | |||
{{reflist|refs= | |||
<ref name="Celovi_2022">{{cite book|url=https://books.google.com/books?id=E4SFkfsOVaoC&pg=PA188|title=Embedded FreeBSD Cookbook|last=Celovi|first=Paul|publisher=]|date=2002|access-date=2022-03-06|pages=108, 187–188|isbn=1-5899-5004-6}}</ref> | |||
<ref name="Computer_2005">{{cite journal|title=The Architecture of Virtual Machines|last1=Smith|first1=James E.|author1-link=James E. Smith (engineer)|last2=Nair|first2=Ravi|journal=]|date=2005-05-16|volume=38|issue=5|pages=33–34|doi=10.1109/MC.2005.173|url=http://digital.library.wisc.edu/1793/11154 }}</ref> | |||
<ref name="Fisher_2019">{{cite web |url=https://www.lifewire.com/list-of-executable-file-extensions-2626061 |title=List of Executable File Extensions |author-last=Fisher |author-first=Tim |website=lifewire.com |language=en |access-date=2019-09-18}}</ref> | |||
<ref name="GFG_2015">{{cite web |url=https://www.geeksforgeeks.org/machine-instructions/ |title=Machine Instructions |date=2015-11-03 |website=GeeksforGeeks |language=en-US |access-date=2019-09-18}}</ref> | |||
<ref name="LB_2019">{{cite web |url=https://refspecs.linuxbase.org/elf/gabi4+/ch4.intro.html |title=Chapter 4: Object Files |website=refspecs.linuxbase.org |access-date=2019-09-18}}</ref> | |||
<ref name="McKellar_2010">{{cite web |url=https://blogs.oracle.com/ksplice/entry/hello_from_a_libc_free |title=Hello from a libc-free world! (Part 1) |date=2010-03-16 |author-first=Jessica |author-last=McKellar}}</ref> | |||
<ref name="Mueller_2007">{{cite book|url=https://books.google.com/books?id=Ua819DVKQPwC&pg=PA24|title=Windows Administration at the Command Line for Windows Vista, Windows 2003, Windows XP, and Windows 2000|last=Mueller|first=John Paul|publisher=]|date=2007|access-date=2023-03-06|page=24|isbn=978-0-470-04616-6}}</ref> | |||
<ref name="MW_2008">{{cite web |url=http://www.merriam-webster.com/dictionary/executable |title=executable |access-date=2008-07-19 |work=Merriam-Webster's Online Dictionary |publisher=]}}</ref> | |||
<ref name="Page_2009">{{cite book|url=https://books.google.com/books?id=XH4sIpY1D70C&pg=PA415|title=A Practical Introduction to Computer Architecture|last=Page|first=Daniel|publisher=]|date=2009|access-date=2023-03-06|pages=415–416|isbn=978-1-84882-255-9}}</ref> | |||
<ref name="Rusling_1999">{{cite book|chapter-url=https://tldp.org/LDP/tlk/kernel/processes.html|chapter=Chapter 4 – Processes|title=The Linux Kernel|last=Rusling|first=David A.|date=1999|access-date=2023-03-06|at=sec. 4.8.1 – ELF}}</ref> | |||
}} | |||
==External links== | |||
* at What Is | |||
{{Executables}} | |||
] | |||
] |
Latest revision as of 17:49, 14 October 2024
A file that causes a computer to follow indicated instructions This article is about a general type of computer file. For the specific file type used in some operating systems, see .exe.
Program execution |
---|
General concepts |
Types of code |
Compilation strategies |
Notable runtimes |
|
Notable compilers & toolchains |
|
In computer science, 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 that must be interpreted (parsed) by an interpreter to be functional.
The exact interpretation depends upon the use. "Instructions" is traditionally taken to mean machine code instructions for a physical CPU. In some contexts, a file containing scripting instructions (such as bytecode) may also be considered executable.
Generation of executable files
See also: Object fileExecutable files can be hand-coded in machine language, although it is far more convenient to develop software as source code in a high-level language that can be easily understood by humans. In some cases, source code might be specified in assembly language instead, which remains human-readable while being closely associated with machine code instructions.
The high-level language is compiled into either an executable machine code file or a non-executable machine code – object file 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 (ELF) or Portable Executable (PE) which is 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, 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.
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, or boot loader), an executable 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. In more complicated interfaces, executable files have additional metadata specifying a separate entry point. For example, in ELF, the entry point is defined in the header's e_entry
field, which specifies the (virtual) memory address at which to start execution. In the GNU Compiler Collection, this field is set by the linker based on the _start
symbol.
See also
References
- Celovi, Paul (2002). Embedded FreeBSD Cookbook. Elsevier. pp. 108, 187–188. ISBN 1-5899-5004-6. Retrieved 2022-03-06.
- "executable". Merriam-Webster's Online Dictionary. Merriam-Webster. Retrieved 2008-07-19.
- 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.
- "Machine Instructions". GeeksforGeeks. 2015-11-03. Retrieved 2019-09-18.
- "Chapter 4: Object Files". refspecs.linuxbase.org. Retrieved 2019-09-18.
- Fisher, Tim. "List of Executable File Extensions". lifewire.com. Retrieved 2019-09-18.
- McKellar, Jessica (2010-03-16). "Hello from a libc-free world! (Part 1)".
- Smith, James E.; Nair, Ravi (2005-05-16). "The Architecture of Virtual Machines". Computer. 38 (5): 33–34. doi:10.1109/MC.2005.173.
- Rusling, David A. (1999). "Chapter 4 – Processes". The Linux Kernel. sec. 4.8.1 – ELF. Retrieved 2023-03-06.
- Page, Daniel (2009). A Practical Introduction to Computer Architecture. Springer Science+Business Media. pp. 415–416. ISBN 978-1-84882-255-9. Retrieved 2023-03-06.
External links
- EXE File Format at What Is
Executable and object file formats | |
---|---|