I have never encounted this error on my old linux machine(both are intel 32bit) so I am at a loss.
I am trying to assemble and link assembly code (which is very simplistic and should work) but ld
is giving the error
rs.o: In function `_start':
(.text+0x11): undefined reference to `eax'
the line in question is the pushl %eax
line. I only need to push a single byte of 0 to the stack so I decided to use the xor'd eax
register. but pushb
gives me an "invalid suffix or operands for push" error while assembling with as
using the code pushb %al
and if I try to use pushl %eax
as
assembles fine but the linker yells at me.
here is the code.
.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
any help is appreciated.