Why doesn't time() from time.h have a syscall to sys_time? : <p>I wrote a very simple program with calls <code>time()</code> to illustrate the use of<code>strace</code>, but I'm having a problem; the <code>time()</code> call doesn't seem to actually produce a syscall!</p>

<p>I ended up stepping into the <code>time()</code> function in GDB and now I'm more confused than ever. From the disassembly of the <code>time()</code> function:</p>

<pre><code>0x7ffff7ffad90 &lt;time&gt;:  push   rbp
0x7ffff7ffad91 &lt;time+1&gt;:    test   rdi,rdi
0x7ffff7ffad94 &lt;time+4&gt;:    mov    rax,QWORD PTR [rip+0xffffffffffffd30d]        # 0x7ffff7ff80a8
0x7ffff7ffad9b &lt;time+11&gt;:   mov    rbp,rsp
0x7ffff7ffad9e &lt;time+14&gt;:   je     0x7ffff7ffada3 &lt;time+19&gt;
0x7ffff7ffada0 &lt;time+16&gt;:   mov    QWORD PTR [rdi],rax
0x7ffff7ffada3 &lt;time+19&gt;:   pop    rbp
0x7ffff7ffada4 &lt;time+20&gt;:   ret 
</code></pre>

<p>How is this function actually getting the current time if it does not call the kernel? Its flow is:</p>

<ul>
<li>Prologue</li>
<li>Get some value from <code>(0x7ffff7ffad94 + 0xffffffffffffd30d)</code> (<code>0x7ffff7ff80a8</code>) and put it in rax (to be returned)</li>
<li>Check if rdi (first argument) was null</li>
<li>If not put the value in rax (return value) there also</li>
<li>Epilogue</li>
</ul>

<p>This makes sense with the functionality of <code>time()</code>; if the argument is null, it just returns the value, but if not it also puts it in the argument. The question I have is, where is it getting the time value? What's so magical about address <code>0x7ffff7ff80a8</code>, and how does it do this without a syscall?</p>

<p>I'm using GCC 6.3.0 and Ubuntu GLIBC 2.24-9ubuntu2.2.</p>
