0Pricing
Assembly Language & x86 Low-Level Systems Programming · 课时

汇编、链接与运行工具链

跟随一个汇编源文件从文本变为正在运行的程序:了解汇编器、链接器和加载器如何协作,将助记符转换为可执行文件。

汇编、链接与运行工具链 是 CoddyKit 上的免费 Assembly Language & x86 Low-Level Systems Programming 课时。 这是第 4 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Assembly Language & x86 Low-Level Systems Programming 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Assembly Language & x86 Low-Level Systems Programming 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

From Mnemonics to Machine Code

You write assembly in mnemonics like MOV and ADD, but the CPU only speaks binary machine code. The toolchain bridges that gap.

Step 1: The Assembler

Step 1: the assembler translates each mnemonic into its machine-instruction bytes, producing an object file (.o or .obj).

nasm -f elf64 hello.asm -o hello.o

Object Files

An object file holds machine code plus metadata — symbols, sections, relocations. It isn't runnable yet because addresses aren't final.

Sections

Code and data live in named sections: .text for instructions, .data for initialized data, .bss for uninitialized data.

Step 2: The Linker

Step 2: the linker combines object files, resolves the symbol references between them, and assigns final addresses to build the executable.

ld hello.o -o hello

Symbols and Relocation

When code calls a label defined elsewhere, the assembler leaves a placeholder. The linker fills in the real address during relocation.

Step 3: The Loader

Step 3: when you run it, the OS loader maps the sections into memory, sets up the stack, and jumps to the entry point.

./hello

The Entry Point

Execution begins at a start symbol — typically _start for raw Linux assembly, or main when you link with the C runtime.

global _start
_start:

Static vs Dynamic Linking

Static linking copies library code into the binary; dynamic linking loads shared libraries at run time, keeping the executable smaller.

Inspecting the Output

Inspect each stage: objdump disassembles, readelf shows headers and sections, and nm lists the symbols.

objdump -d hello

Putting It Together

The full flow: assembler turns .asm into objects, the linker joins objects into an executable, and the loader runs it as a process.

Quick Check

Test your understanding of the toolchain.

Recap

You learned the toolchain: assembler makes objects, the linker resolves symbols into an executable, and the loader turns it into a running process.

常见问题解答

「汇编、链接与运行工具链」课时是免费的吗?

是的 — 「汇编、链接与运行工具链」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Assembly Language & x86 Low-Level Systems Programming 课程的其余内容,请升级到 CoddyKit PRO。 Assembly Language & x86 Low-Level Systems Programming 课程共包含 4 节课。

「汇编、链接与运行工具链」这节课中我会学到什么?

跟随一个汇编源文件从文本变为正在运行的程序:了解汇编器、链接器和加载器如何协作,将助记符转换为可执行文件。 你通过在浏览器中直接运行的动手代码来练习 Assembly Language & x86 Low-Level Systems Programming,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Assembly Language & x86 Low-Level Systems Programming 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Assembly Language & x86 Low-Level Systems Programming 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 4 节课,共 4 节。

「汇编、链接与运行工具链」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Assembly Language & x86 Low-Level Systems Programming 课中编写并运行代码吗?

能。每节 Assembly Language & x86 Low-Level Systems Programming 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 什么是汇编语言
  2. x86 架构基础
  3. 您的第一个汇编程序
  4. 汇编、链接与运行工具链
← 返回 Assembly Language & x86 Low-Level Systems Programming