<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 - using arm thumb register r7 in inline asm with -pg"
href="https://bugs.llvm.org/show_bug.cgi?id=45826">45826</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>using arm thumb register r7 in inline asm with -pg
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>arnd@linaro.org
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>With clang-8 or higher, I get errors about using the frame pointer register
(r7) when building the Linux kernel in thumb mode with "ftrace" enabled, which
passes '-pg', e.g.:
arch/arm/probes/kprobes/actions-thumb.c:449:3: error: inline asm clobber
list contains reserved registers: R7 [-Werror,-Winline-asm]
"msr cpsr_fs, %[oldcpsr] \n\t"
arch/arm/probes/kprobes/actions-thumb.c:449:3: note: Reserved registers on
the clobber list may not be preserved across the asm statement, and clobbering
them may lead to undefined behaviour.
See <a href="https://godbolt.org/z/6aVF_5">https://godbolt.org/z/6aVF_5</a> for a minmal example, also
$ echo 'void f(void) { asm("mov r7, #0" ::: "r7"); }' | clang-10
--target=arm-linux-gnueabi -O2 -funwind-tables -mthumb -pg -S -xc -
<stdin>:1:20: warning: inline asm clobber list contains reserved registers: R7
[-Winline-asm]
gcc produces the same error when I pass "-fno-omit-frame-pointer" or "-O0".
Both clang and gcc produce an error when combining "-pg" with
"-fomit-frame-pointer".
However, gcc can compile the example and the kernel source files with "-mthumb
-O2 -pg" as long as neither "-fomit-frame-pointer" nor
"-fno-omit-frame-pointer" is used.
I don't actually know which behavior is correct here, but I assume that either
clang or gcc does something wrong here. Opening the bug against clang for now
as it caused the symptom of the broken kernel configuration.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>