title: Assembler Error: Mach-O 64 bit does not support absolute 32 bit addresses
body: <p>So I'm learning x86_64 nasm assembly on my mac for fun. After hello world and some basic arithmetic, I tried copying a slightly more advanced hello world program from <a href="http://richard.jp.leguen.ca/not-blog/nasm-programming-for-soen228" rel="noreferrer">this site</a> and modifying it for 64 bit intel, but I can't get rid of this one error message: <code>hello.s:53: error: Mach-O 64-bit format does not support 32-bit absolute addresses</code>. Here is the command I use to assemble and link: <code>nasm -f macho64 hello.s &amp;&amp; ld -macosx_version_min 10.6 hello.o</code>. And here is the relevant line:</p>
  
  <pre><code>cmp rsi, name+8
  </code></pre>
  
  <p>rsi is the register I am using for my index in the loop, and name is a quad word reserved for the user input which is the name, which by this point has already been written.</p>
  
  <p>Here is a part of the code (to see the rest, click the link and go to the bottom, the only difference is that I use 64 bit registers):</p>
  
  <pre><code>loopAgain:
  mov al, [rsi]           ; al is a 1 byte register
  cmp al, 0x0a            ; if al holds an ascii newline...
  je exitLoop             ; then jump to label exitLoop
  
  ; If al does not hold an ascii newline...
  mov rax, 0x2000004      ; System call write = 4
  mov rdi, 1              ; Write to stdout = 1
  mov rdx, 1              ; Size to write
  syscall
  
  inc rsi
  
  cmp rsi, name+8         ; LINE THAT CAUSES ERROR
  jl loopAgain
  </code></pre>