Skip to content
BENIBIX Learn

Machine Code

Development⚙️ Compilers & RuntimesCompilation

Also known as Machine Language, Native Code, Binary Code

The raw steps a chip runs on its own. Compilers make it for you.

Think of it like

Think of it like the holes in a music box drum. The box plays them, but people cannot read the tune from them.

Example

A phone chip and a laptop chip speak different machine code. That is why one app file cannot run on both.

Why it matters

All software ends up as machine code in the end. It is why a program built for one chip may not run on another.

Definition

Machine code is the set of simple steps a computer's chip runs directly. Each step is a number, like add two values or jump to another step. Every chip family has its own, so code made for one may not run on another. People almost never write it by hand. A compiler makes it from code written in a language people can read.

Example code

console
$ objdump -d add.o
0000000000000000 <add>:
   0:	f3 0f 1e fa   endbr64
   4:	8d 04 37      lea    (%rdi,%rsi,1),%eax
   7:	c3            ret
The pairs of letters and digits are the machine code. The words beside them are a readable version.

Common mistake

Thinking source code is what the computer runs. It always has to be turned into machine code first.

Key takeaways

  1. 1
    Chip's own steps. The chip runs it with no help.
  2. 2
    One per chip family. Code for one chip may not fit another.
  3. 3
    Made, not written. Compilers write it, not people.

Compare