gcc -m64 -fPIC 编译问题
来源:互联网 发布:摇滚莫扎特 知乎 编辑:程序博客网 时间:2024/05/20 13:39
做FreeBSD64位移植时,cpuid指令与gcc -fPIC开关冲突:由于-fPIC需要独占ebx,而cpuid要使用ebx,故修改汇编语句,不明确使用"=b",使gcc通过。
原:
修改:
后记:
参考 http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
原:
asm("cpuid": "=a" (out_eax), "=b" (out_ebx), "=c" (out_ecx), "=d" (out_edx) : "a" (function));
修改:
asm volatile("pushl %%ebx \n\t" /* save %ebx */"cpuid \n\t""movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */"popl %%ebx \n\t" /* restore the old %ebx */: "=a"(out_eax), "=r"(out_ebx), "=c"(out_ecx), "=d"(out_edx): "a"(function): "cc");
后记:
#ifdef X86AMD64uint64_t local_rax, local_rbx, local_rcx, local_rdx;asm volatile("push %%rbx \n\t""cpuid \n\t""mov %%rbx, %1 \n\t""pop %%rbx \n\t": "=a"(local_rax), "=r"(local_rbx), "=c"(local_rcx), "=d"(local_rdx): "a"(function): "cc");out_eax = local_rax;out_ebx = local_rbx;out_ecx = local_rcx;out_edx = local_rdx;#elseasm volatile("pushl %%ebx \n\t""cpuid \n\t""movl %%ebx, %1 \n\t""popl %%ebx \n\t": "=a"(out_eax), "=r"(out_ebx), "=c"(out_ecx), "=d"(out_edx): "a"(function): "cc");#endif
参考 http://sam.zoy.org/blog/2007-04-13-shlib-with-non-pic-code-have-inline-assembly-and-pic-mix-well
- gcc -m64 -fPIC 编译问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- gcc编译参数-fPIC的一些问题
- 打印Java异常信息
- :/etc/profile
- 转:九月十月百度人搜,阿里巴巴,腾讯华为笔试面试八十题(第331-410题)
- 图灵奖得主John Hopcroft:计算机科学的新方向
- PLSQL小结
- gcc -m64 -fPIC 编译问题
- hdu 1171 多重背包
- java程序员菜鸟进阶(一)oracle基础详解(一)Windows_7安装oracle和简单配置详解
- Linux系统的etc目录
- oracle dataguard 优化
- FreeBSD中基于ncurses的服务器状态监视器
- 支持向量机通俗导论(理解SVM的三层境界)
- apache和tomcat有什么不同,为什么要整合apache 和tomcat?
- hdu 1248 多重背包水题