要解决的问题如下:
/usr/bin/ld: 当搜索用于 /usr/lib/x86_64-linux-gnu//libc.so 时跳过不兼容的 -lc
或者在连接的时候ld提示
ld: i386:x86-64 architecture of input file `multest.o’ is incompatible with i386 output
或者编译生成可执行文件运行后提示
bash: ./multest: 正在访问一个已毁坏的共享库。
我的系统是64位的ubuntu20.04。
汇编代码例子如下(已将入口点_start标签改为main)
# multest.s - An example of using the MUL instruction
.section .data
data1:
.int 315814
data2:
.int 165432
result:
.quad 0
output:
.asciz "The result is %qd\n"
.section .text
.globl main
main:
nop
movl data1, %eax
mull data2
movl %eax, result
movl %edx, result+4
pushl %edx
pushl %eax
pushl $output
call printf
add $12, %esp
pushl $0
call

在Ubuntu 20.04 64位系统中,编译32位汇编程序时可能会遇到动态库不兼容、汇编指令错误等问题。解决方法包括使用`gcc -m32`或`as --32`配合`ld -m elf_i386`指定32位模式,并确保正确指定库路径和动态链接器。同时,需要安装`gcc-multilib`和`g++-multilib`支持32位编译。
最低0.47元/天 解锁文章
2344

被折叠的 条评论
为什么被折叠?



