本文笔记学习自《Professional Assembly Language》
静态库
当我们将不同的函数写在不同的文件中,如果主程序调用这些函数,就需要相应的目标文件才能生成可执行文件。目标文件很多的话,不便于管理。我们可以将目标文件整合到一个存档文件中,编译器从存档文件挑选出需要的目标文件,这样的存档文件称之为库文件(library file)。 假设库文件的目标代码被编译到了主程序中,就称之为静态库文件(windows下对应着LIB文件)。 linux下有ar工具可以创建静态库文件。
ar - create,
modify,
and extract from archives
ar [--plugin name] [-X32_64] [-]p[mod [relpos] [count]]
archive [member...]
以计算圆的面积areafunc.s进行说明。 areafunc.s:
.section .text
.type areafunc,
@function
.globl areafunc
areafunc:
pushl
转载请注明原文地址: https://ju.6miu.com/read-4915.html