如何编译文件(gcc + nasm)
来源:互联网 发布:淘宝输入口令抢流量 编辑:程序博客网 时间:2024/05/11 17:03
【0】README
编译文件(nasm + gcc),特别是编译目标文件的依赖文件;本文旨在回顾 gcc 和 nams 编译器的编译命令,以及如果有多个依赖文件该如何编译;
【1】编译文件
1.1)编译 lib/syscall.asm(lib/syscall.asm)
nasm -I include/sys/ lib/syscall.asm -o syscall.o
1.2)编译 lib/string.asm(lib/string.asm)
nasm -I include/sys/ lib/string.asm -o string.o
1.3)编译 fs 的接口(lib/open.c + lib/read.c + lib/write.c + lib/close.c + lib/unlink.c)
[hadoop@hadoop0 c]$ gcc -M lib/open.c -I include/ -I include/sys (查找 lib/open.c 所依赖的文件)open.o: lib/open.c include/type.h include/stdio.h include/type.h \ include/sys/const.h include/sys/protect.h include/string.h \ include/sys/fs.h include/sys/proc.h include/sys/tty.h \ include/sys/console.h include/sys/global.h include/sys/proto.h
gcc -I include/ -I include/sys -c -fno-builtin lib/unlink.c -o lib/unlink.o
1.4)编译MM 的 接口(lib/fork.c + lib/exit.c + lib/wait.c)
[hadoop@hadoop0 c]$ gcc -I include/ -I include/sys/ -c -fno-builtin lib/fork.c -o lib/fork.o [hadoop@hadoop0 c]$ gcc -I include/ -I include/sys/ -c -fno-builtin lib/exit.c -o lib/exit.o [hadoop@hadoop0 c]$ gcc -I include/ -I include/sys/ -c -fno-builtin lib/wait.c -o lib/wait.o
1.5)编译SYS 的接口(lib/getpid.c)
gcc -I include/ -I include/sys/ -c -fno-builtin lib/getpid.c -o lib/getpid.o
1.6)others (lib/misc.c + lib/vsprinf.c + lib/printf.c)
[hadoop@hadoop0 c]$ gcc -I include/ -I include/sys/ -c -fno-builtin lib/misc.c -o lib/misc.o [hadoop@hadoop0 c]$ gcc -I include/ -I include/sys/ -c -fno-builtin lib/vsprintf.c -o lib/vsprintf.o [hadoop@hadoop0 c]$ gcc -I include/ -I include/sys/ -c -fno-builtin lib/printf.c -o lib/printf.o
1.7)将上述目标文件编译为 C运行时库
[hadoop@hadoop0 c]$ ar rcs lib/orangescrt.a lib/syscall.o lib/printf.o lib/vsprintf.o \> lib/string.o lib/misc.o lib/open.o lib/read.o lib/write.o lib/close.o \> lib/unlink.o lib/getpid.o lib/fork.o lib/exit.o lib/wait.o
0 0
- 如何编译文件(gcc + nasm)
- GCC跟NASM联合编译
- cmake 编译 nasm 文件
- NASM GCC混合编译16位二进制文件。。。。
- GCC+NASM
- 使用GCC和NASM在Linux下联合编译
- Ubuntu下用gcc与nasm联合编译
- Ubuntu下用gcc与nasm联合编译
- NASM编译出PE文件[转]
- VS2015使用NASM编译汇编文件
- GCC在编译时如何寻找所需要的头文件(转)
- GCC编译之如何控制共享文件导出符号
- GCC编译之如何控制共享文件导出符号
- GCC编译之如何控制共享文件导出符号
- GCC编译之如何控制共享文件导出符号
- GCC编译之如何控制共享文件导出符号
- GCC编译之如何控制共享文件导出符号
- MinGW(GCC)编译DLL文件
- mogodb 复制集加分片环境搭建
- UVa 332 - Rational Numbers from Repeating Fractions
- vi tag标签 方便查看代码
- C#-队列
- Eclipse中dynamic web project与web project 的区别
- 如何编译文件(gcc + nasm)
- 数组和指针
- DSP学习初阶的一些笔记
- PostgreSQL的hstore初步学习
- xcode7 ios9遇到的几个坑
- 上周的工作总结
- node.js调试
- ZOJ 3913 Bob wants to pour water 二分
- 2015年医学核心期刊目录(有效期自2014年)