Object file
An object file is a file that contains
The object code is usually relocatable, and not usually directly executable. There are various formats for object files, and the same machine code can be packaged in different object file formats. An object file may also work like a shared library.
The metadata that object files may include can be used for linking or debugging; it includes information to resolve symbolic cross-references between different modules,
information. Other metadata may include the date and time of compilation, the compiler name and version, and other identifying information.The term "object program" dates from at least the 1950s:
A term in automatic programming for the machine language program produced by the machine by translating a source program written by the programmer in a language similar to algebraic notation.[1]
A linker is used to combine the object code into one executable program or library pulling in precompiled system libraries as needed.
Object file formats
There are many different object file formats; originally each type of computer had its own unique format, but with the advent of Unix and other portable operating systems, some formats, such as ELF and COFF, have been defined and used on different kinds of systems.
Some systems make a distinction between formats which are directly executable and formats which require processing by the
Unix and Unix-like systems have used the same format for executable and object files, starting with the original a.out format. Some formats can contain machine code for different processors, with the correct one chosen by the operating system when the program is loaded.[3][4]
The design and/or choice of an object file format is a key part of overall system design. It affects the performance of the linker and thus programmer turnaround while a program is being developed. If the format is used for executables, the design also affects the time programs take to begin running, and thus the responsiveness for users.
The GNU Project's Binary File Descriptor library (BFD library) provides a common API for the manipulation of object files in a variety of formats.
Absolute files
Many early computers, or small
Segmentation
Most object file formats are structured as separate sections of data, each section containing a certain type of data. These sections are known as "segments" due to the term "
Types of data supported by typical object file formats:[7]
- Header (descriptive and control information)
- Code segment ("text segment", executable code)
- Data segment (initialized static variables)
- Read-only data segment (rodata, initialized static constants)
- BSS segment(uninitialized static data, both variables and constants)
- External definitions and references for linking
- Relocationinformation
- Dynamic linkinginformation
- Debugging information
Segments in different object files may be combined by the linker according to rules specified when the segments are defined. Conventions exist for segments shared between object files; for instance, in DOS there are different memory models that specify the names of special segments and whether or not they may be combined.[8]
The debugging data format of debugging information may either be an integral part of the object file format, as in COFF, or a semi-independent format which may be used with several object formats, such as stabs or DWARF.
See also
- OS/360 Object File Format
- Intel hexadecimal object file format(typically with file extension .HEX, but sometimes also with .OBJ)
- Object Module Format (ICL)(OMF for ICL VME)
- Object Module Format (Intel) (OMF for Intel 8080/8085, OBJ for Intel 8086)
- Mach-O
References
- McGraw-Hill. p. 222. Retrieved 2020-07-31.
- IBM Corporation. 1973. p. 16. Retrieved 2012-08-06.
- ^ "Universal Binaries and 32-bit/64-bit PowerPC Binaries". OS X ABI Mach-O File Format Reference. Apple Inc. 2009-02-04 [2003]. Archived from the original on 2014-09-04.
- ^ "FatELF: Universal Binaries for Linux". Retrieved 2020-08-02.
- ^ Wiles, Mike; Felix, Andre. MCM6830L7 MIKBUG/MINIBUG ROM (PDF). Motorola Semiconductor Products, Inc. Retrieved 2020-07-31.
- ISBN 978-81-8431-355-0.
- ISBN 978-0-470-34343-2. Retrieved 2020-08-01.
- ISBN 0-02-359651-1.
Further reading
- OCLC 42413382. Archived from the original on 2013-01-25. Retrieved 2020-01-12. Code: [1][2] Errata: [3]
- The Microsoft OBJ File Format. Microsoft, Product Support Services. Application Note SS0288. Archived from the original on 2017-09-09. Retrieved 2017-08-21.
- Elliott, John C. (2002). "Microsoft REL file format". seasip.info. Archived from the original on 2023-11-25. Retrieved 2023-11-25. (NB. Description of the Microsoft REL file format for relocatable objects, also used by Digital Research.)
- Elliott, John C. (2012-06-05) [2000-01-02]. "PRL file format". seasip.info. Archived from the original on 2020-01-26. Retrieved 2020-01-26. [4]
- (PDF) from the original on 2023-11-28. Retrieved 2023-11-28. (16 pages)
- Montuelle, Jean; Willers, Ian (25–28 September 1979) [October 1978]. Written at CERN, Geneve, Switzerland. Cross Software Using a Universal Object Module Format, CUFOM. Euro IFIP, London, UK. CERN-DD/78/20. Retrieved 2023-11-28. (1+23 pages)
- Microprocessor Universal Format for Object Modules, MUFOM (draft document), IEEEWorking Group, P695lD2
- Montuelle, Jean; Willers, Ian (September 1982). "Letter to the Editor". from the original on 2023-11-28. Retrieved 2023-11-28. (1 page) (NB. Describes the history and relationship of IEEE 695 with CUFOM and MUFOM.)
- IEEE 695-1990: IEEE Standard for Microprocessor Universal Format for Object Modules. ISBN 978-0-7381-3028-6. (NB. Superseeds IEEE 695-1985 (1985-09-09)).