ran*_*eld 0 linux x86 assembly ld
我从来没有把这个错误包含在我的旧linux机器上(两者都是intel 32bit),所以我很茫然.
我试图组装和链接汇编代码(这是非常简单的,应该工作),但是ld给出了错误
rs.o: In function `_start':
(.text+0x11): undefined reference to `eax'
Run Code Online (Sandbox Code Playgroud)
有问题的pushl %eax线是线.我只需要将0的单个字节推送到堆栈,所以我决定使用xor'd eax寄存器.但是在使用代码组装时pushb给了我一个" 无效后缀或操作数推送 "错误,如果我尝试使用汇编很好但链接器对我大喊大叫.aspushb %alpushl %eax as
这是代码.
.section .data
.section .text
.global _start
_start:
xorl %eax, %eax
#sys_socketcall(int call, __user *args)
#sys_socket(int domain, int type, int protocol)
pushl %eax #protocol: 0
pushl $1 #type: SOCK_STREAM
pushl $2 #domain: AF_INET
movL $1, %ebx #sys_socket
movl $102, %eax #sys_socketcall
int $0x80
movl $eax, %ebx #move socket fd to check echo $?
movl $1, %eax #exit
int $0x80
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.
你的程序集中有错误:$eax应该%eax在
movl $eax, %ebx #move socket fd to check echo $?
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1725 次 |
| 最近记录: |