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