title: 64 bit assembly fixup error
body: <p>I'm trying to run a test program the prof gave us for 64- bit assembly, and it's not worker properly.</p>
  
  <p>the error is:
  error LNK2017: 'ADDR32' relocation to 'naturals' invalid without /LARGEADDRESSAWARE:NO
  fatal error LNK1165: link failed because of fixup errors</p>
  
  <p>The code is:</p>
  
  <pre><code>; no need for .386, .586, .MODEL directives in 64-bit programs
  
  .DATA
  
  sentence BYTE "Now is the winter of our discontent", 0h
  firstWord BYTE 20 DUP (?)
  space BYTE ' '
  
  naturals QWORD 10 DUP (?)
  sum QWORD ?
  
  .CODE
  
  main proc
  
      ; test out our getFirstWord procedure
  
      ; the second argument
      mov rax, offset firstWord
      push rax
  
      ; the first argument
      mov rax, offset sentence
      push rax
  
      call getFirstWord
  
      ; initialize our 'naturals' array
      mov rcx, 1
      mov rdi, 0
  
  nextNumber:
  
      mov naturals[rdi*8], rcx
  
  
  
      inc rcx
  
      cmp rcx, 10
      jg initializationComplete
  
      inc rdi
  
      jmp nextNumber
  
  initializationComplete:
  
      ; test out our sumArray procedure
  
      ; second argument (number of elements in array)
      mov rax, 10
      push rax
  
      ; first argument (array address, alternative to offset)
  
      lea rax, naturals
      push rax
  
      call sumArray
  
      ; store the result in memory
      mov sum, rax
  
      ; exit
  
      mov rax, 0
      ret
  
  main endp
  
  getFirstWord proc
  
      ;pop rax ; address of sentence
      ;pop rbx ; address of firstWord
  
      mov rax, [esp+8]
      mov rbx, [esp+16]
      mov rcx, 0
      mov cl, [space]
  
  nextCharacter:
      cmp [rax], byte ptr 0   ; check for a null-terminator in the sentence
      je allDone
  
      cmp cl, [rax] ; check for a space in the sentence
      je nullTerminate
  
      mov dl, [rax] ; copy the current character
      mov [rbx], dl
  
      inc rax
      inc rbx
  
      jmp nextCharacter
  
  nullTerminate:
  
      inc rbx
      mov byte ptr [rbx], 0
  
  allDone:
  
      ret 16
  
  getFirstWord endp
  
  sumArray proc
  
      ; get the address of the array
      mov rax, [rsp+8]
  
      ; get the number of elements in the array
      mov rcx, [rsp+16]
  
      xor rbx, rbx  ; initialize sum to zero
      xor rsi, rsi  ; initialize counter to zero
  
  nextArrayElement:
      add rbx, [rax]
      add rax, 8
  
      inc rsi
  
      cmp rsi, rcx
      je finishedSum
  
      jmp nextArrayElement
  
  finishedSum:
  
      mov rax, rbx
  
      ret 16
  
  sumArray endp
  
  END
  </code></pre>
  
  <p>I tried setting LARGEADDRESSAWARE to NO, and the program will compile and build, but there's no output. Is there not suppose to be any output and it just needs to run? Or is that setting screwing something up? I also tried changing how naturals is moved, but the only thing that somewhat worked was changing the address setting.</p>