does gcc preserve callee save registers
<p>As you might have guessed the question is does <code>gcc</code> automaticly saves callee-save registers or should I do it by myself? I thought that <code>gcc</code> would do that for me but when I wrote this code</p>

<pre><code>void foo(void) {
    __asm__ volatile ("mov $123, %rbx");
}

void main(void) {
    foo();
}
</code></pre>

<p>after <code>gcc a.c &amp;&amp; objdump -d a.out</code> I saw this</p>

<pre><code>00000000004004f6 &lt;foo&gt;:
  4004f6:   55                      push   %rbp
  4004f7:   48 89 e5                mov    %rsp,%rbp
  4004fa:   48 c7 c3 7b 00 00 00    mov    $0x7b,%rbx
  400501:   90                      nop
  400502:   5d                      pop    %rbp
  400503:   c3                      retq   

0000000000400504 &lt;main&gt;:
  400504:   55                      push   %rbp
  400505:   48 89 e5                mov    %rsp,%rbp
  400508:   e8 e9 ff ff ff          callq  4004f6 &lt;foo&gt;
  40050d:   90                      nop
  40050e:   5d                      pop    %rbp
  40050f:   c3                      retq
</code></pre>

<p>According to x86-64 ABI <code>%rbx</code> is a callee-save register but in this code <code>gcc</code> did not save it in <code>foo</code> before modifying. Is it just because I don't use <code>%rbx</code> in main function after calling <code>foo()</code> or it's bacause <code>gcc</code> does not provide such garanties and I have to save it by myself in <code>foo</code> before modifying?</p>