title: Illegal instruction: 4 (Mac 64-bit, NASM)
body: <p>I'm trying to write a simple helloworld in assembler 64 on Mac with NASM.
  Every time I try to run it I'm getting this error:</p>
  
  <pre><code>Illegal instruction: 4
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>section .text
  global _main
  
  _main:
      mov rax, 4
      mov rbx, 1
      mov rcx, tekst
      mov rdx, dlugosc
      int 80h
  
      mov rax, 1
      int 80h
  
  section .data
  
  tekst   db  "Hello, world", 0ah
  dlugosc equ $ - tekst
  </code></pre>
  
  <p>I'm compiling with: </p>
  
  <pre><code>nasm -f macho64 HelloWorld.asm
  </code></pre>
  
  <p>And I'm linking with:</p>
  
  <pre><code>ld -o HelloWorld -arch x86_64 -macosx_version_min 10.10 -lSystem -no_pie HelloWorld.o
  </code></pre>
  
  <p>Any help is highly appreciated.</p>