What is Object Code in a Computer Program?

Object code refers to the code generated by a compiler or assembler in computer science after processing source code. It generally consists of machine code or code close to machine language.

Object code refers to the code generated by a compiler or assembler in computer science after processing source code. It generally consists of machine code or code close to machine language.
Chinese name
Object code
Foreign name
object code
Explanation
Code generated by the assembler after processing the source code
Make up
Machine code or code close to machine language

Object code introduction

Object code refers to the code generated by a compiler or assembler in computer science after processing source code. It generally consists of machine code or code close to machine language. An object file is a computer file that stores object code. It is often called a binary file. Object files contain machine code (which can be executed directly by the computer's central processor) and data used by the code at runtime, such as relocation information, such as program symbols (names of variables and functions) for linking or debugging, and also Other debugging information. [2] Object files are the intermediate products of the process of generating program files from source code files. The linker generates object files or library files by linking the object files together. The only element in an object file is machine code. For example, an object file for an embedded system may contain only machine code.

Object code form

Object code usually takes three forms: machine language, assembly language, and machine language modules to be assembled.
The issues that should be considered when generating the object code are: (1) how to make the generated object code shorter; (2) how to make full use of registers to reduce the number of accesses to memory; (3) how to make full use of the characteristics of the system only.

Object code object file format

Object file A computer file format used to store object code and related data generated by a compiler or assembler is called an object file format.
There are many different types of object file formats. Each type of computer originally had its own unique format, but with the advent of Unix and other portable operating systems, formats such as COFF and ELF were defined and used on different systems. Generally, the linker's input and output use the same file format, as do the library and executable file formats.
Designing or choosing an object file format is a key part of the overall design of a computing system. It affects the performance of the linker and therefore the total time spent by the programmer during development; if the format is for an executable file, the design of the format also affects the time it takes for the program to start running and the system The response speed of user requests. Most object file formats are organized in blocks, and each block is loaded with the same data. When these blocks are needed by the virtual memory system, it can be paged in and used without further processing.
The simplest object file format is the DOS COM file format, which is a file consisting of raw data only. COM format files are always loaded into a fixed location. Other formats are composed of a series of complex and precise data structure sequences. The specifications of these formats usually have many pages.
Debug information can be a component of the object file format, as in COFF, or a semi-independent format that may be used by several object formats, such as stabs or DWARF.
The GNU Project's BFD library provides a common set of application programming interfaces for manipulating a wide variety of object file formats.
The data types supported by typical object file formats are:
1. Symbol starting area (abbreviation of BSSBlockStartedbySymbol);
2. Text segment (textsegment or translated as code segment);
3. Data segments (datasegment).

Object code main format

  • DOS [1]
    • COM
    • EXE (MZ)
    • Relocatable Object Module Format (Relocatable Object Module Format is generally called "OBJ file" or "OMF", also used by some development tool vendors in Microsoft Windows operating system)
  • Embedded Systems
    • IEEE-695
    • S-records
  • Macintosh
    • PEF / CFM
  • Unix
    • ECOFF (Mips)
    • XCOFF (AIX)
    • a.out (Unix / Linux)
    • COFF (System V)
    • Executable and Linkable Format (System V abbreviated ELF, used in most modern computing systems)
    • Mach-O (NeXT, Mac OS X)
  • Windows
    • 16-bit New Executable
    • Portable Executable
  • other
    • IBM 360 target format
    • NetWare Loadable Module (NetWare Lodable Modular Abbreviation NLM)
    • OMF (VME)
    • SOM (HP)
    • XBE (Xbox's executable file format)
    • APP (Symbian OS executable file format)
    • Relocatable dynamic object file format ( R elocatable D ynamic Object File F ormat abbreviated as RDOFF)
    • Hunk (AmigaOS)

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?