<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - rbp being used as a scratch register"
href="https://bugs.llvm.org/show_bug.cgi?id=43128">43128</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>rbp being used as a scratch register
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: X86
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>ndesaulniers@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, spatel+llvm@rotateright.com
</td>
</tr>
<tr>
<th>Blocks</th>
<td>4068
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=22435" name="attach_22435" title="x.c">attachment 22435</a> <a href="attachment.cgi?id=22435&action=edit" title="x.c">[details]</a></span>
x.c
>From this discussion on LKML: <a href="https://lkml.org/lkml/2019/8/27/837">https://lkml.org/lkml/2019/8/27/837</a>
it seems that clang-9 and newer are using %rbp as a scratch register in leaf
functions (regardless of -fomit-frame-pointer/-fno-omit-frame-pointer).
A custom object file validator in the kernel is warning that due to this
codegen, it may not be able to unwind correctly through leaf functions.
A test case from Arnd is attached.
$ clang -c x.c -O2 -fomit-frame-pointer
$ llvm-objdump -d x.o | grep -e rbp -e ebp -e bp -e bpl
0: 55 pushq %rbp
60: 0f b6 ef movzbl %bh, %ebp
68: 33 1c aa xorl (%rdx,%rbp,4), %ebx
73: 0f b6 ef movzbl %bh, %ebp
79: 33 1c aa xorl (%rdx,%rbp,4), %ebx
95: 5d popq %rbp</pre>
</div>
</p>
<div id="referenced">
<hr style="border: 1px dashed #969696">
<b>Referenced Bugs:</b>
<ul>
<li>
[<a class="bz_bug_link
bz_status_CONFIRMED "
title="CONFIRMED - [Meta] Compiling the Linux kernel with clang"
href="https://bugs.llvm.org/show_bug.cgi?id=4068">Bug 4068</a>] [Meta] Compiling the Linux kernel with clang
</li>
</ul>
</div>
<br>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>