title: Assembly , syscall not work as expected. Ubuntu Linux x86_64 , using AT&T syntax
body: <p>I am testing use of .bss for allocation of a memory area to hold a single number. Then print that number to console. The output is not as expected. I am supposed to get e number (12), but get a newline.</p>
  <p>System config:</p>
  <pre><code>$ uname -a
  Linux 5.8.0-48-generic #54~20.04.1-Ubuntu SMP Sat Mar 20 13:40:25 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  
  description: CPU
  product: Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
  </code></pre>
  <p>The code:</p>
  <pre><code># compile with: gcc -ggdb -nostdlib -no-pie  test.s -o test
  
  .bss
  .lcomm          output,1
  
  .global _start
  .text
  
  _start:
          # test .bss and move numer 12 to rbx where memory are allocated in .bss
          mov     $output, %rbx    # rbx to hold address of allocated space
          mov     $12,%rdx          # Move a number to rdx
          mov     %rdx,(%rbx)       # Move content in rdx to the address where rbx points to (e.g -&gt;output)
  
          # setup for write syscall:  
          mov     $1,%rax          # system call for write, according to syscall table (http://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/)
          mov     $1,%rdi          # fd = 1, stdout
          mov     $output,%rsi     # adress of string to output moved to rsi
          mov     $1,%rdx          # number of bytes to be written
  
          syscall                  # should write 12 in console
  
          mov     $60,%rax
          xor     %rdi,%rdi
          syscall                 # exit normally
  </code></pre>
  <p>I have set a breakpoint with the first syscall (using GDB), to look into the registers:</p>
  <pre><code>i r rax rbx rdx rdi rsi
  
  rax            0x1                 1
  rbx            0x402000            4202496
  rdx            0x1                 1
  rdi            0x1                 1
  rsi            0x402000            4202496
  
  x/1 0x402000
  0x402000 &lt;output&gt;:  12
  </code></pre>
  <p>The output after syscall is blank, was expected to get the number &quot;12&quot;:</p>
  <pre><code>:~/Dokumenter/ASM/dec$ gcc -ggdb -nostdlib -no-pie  test.s -o test
  :~/Dokumenter/ASM/dec$ ./test
  
  :~/Dokumenter/ASM/dec$ ./test
  
  :~/Dokumenter/ASM/dec$ 
  </code></pre>
  <p>So, my question is, are there any obvious explanation of why I am getting blank and not 12 ?</p>