
1、Along with the -m32 flag in gcc, you may need to include the -melf_i386 flag for ld to properly link the 32bit object files to the 32bit libraries if you have both the 32bit and 64bit libraries.
2、 ld命令 ld命令是GNU的连接器,将目标文件连接为可执行程序。
3、举例:
gcc -m32 -o hello hello.c
gcc -m32 -c hello.o hello.c
ld -m elf_i386 -o kernel main.o hello.o
.so是linux用的 所以 要生成so 需要用gcc 和生成可执行文件类似,只是增加一些编译选项 命令如下 gcc SOURCE_FILES -fPIC -shared -o TARGET SOURCE_FILES可以是.c文件,也可以是经过-c编译出来的.o文件 TARGET为so文件。欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)