<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 - invalid operand in inline asm from Linux kernel's fs/readdir.c"
href="https://bugs.llvm.org/show_bug.cgi?id=46186">46186</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>invalid operand in inline asm from Linux kernel's fs/readdir.c
</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>Windows NT
</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: PowerPC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>natechancellor@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>After Linux kernel commit
<a href="https://git.kernel.org/powerpc/c/334710b1496af8a0960e70121f850e209c20958f">https://git.kernel.org/powerpc/c/334710b1496af8a0960e70121f850e209c20958f</a>, the
kernel no longer builds with clang:
$ make -skj64 ARCH=powerpc CC=clang CROSS_COMPILE=powerpc-linux-gnu- O=out
distclean allnoconfig all
../fs/readdir.c:332:2: error: invalid operand in inline asm: '1:
stw${1:X} $0, $12: stw${1:X} ${0:L}, ${1:L}.section __ex_table,"a";
.balign 4; .long (1b) - . ; .long (${2:l}) - . ; .previous .section
__ex_table,"a"; .balign 4; .long (2b) - . ; .long (${2:l}) - . ; .previous '
unsafe_put_user(offset, &prev->d_off, efault_end);
^
../arch/powerpc/include/asm/uaccess.h:604:34: note: expanded from macro
'unsafe_put_user'
#define unsafe_put_user(x, p, e) __put_user_goto(x, p, e)
^
../arch/powerpc/include/asm/uaccess.h:98:2: note: expanded from macro
'__put_user_goto'
__put_user_nocheck_goto((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)),
label)
^
../arch/powerpc/include/asm/uaccess.h:295:2: note: expanded from macro
'__put_user_nocheck_goto'
__put_user_size_goto((x), __pu_addr, (size), label); \
^
../arch/powerpc/include/asm/uaccess.h:284:10: note: expanded from macro
'__put_user_size_goto'
case 8: __put_user_asm2_goto(x, ptr, label); break; \
^
../arch/powerpc/include/asm/uaccess.h:268:3: note: expanded from macro
'__put_user_asm2_goto'
"1: stw%X1 %0, %1\n" \
^
../fs/readdir.c:333:2: error: invalid operand in inline asm: '1:
stw${1:X} $0, $12: stw${1:X} ${0:L}, ${1:L}.section __ex_table,"a";
.balign 4; .long (1b) - . ; .long (${2:l}) - . ; .previous .section
__ex_table,"a"; .balign 4; .long (2b) - . ; .long (${2:l}) - . ; .previous '
unsafe_put_user(ino, &dirent->d_ino, efault_end);
^
../arch/powerpc/include/asm/uaccess.h:604:34: note: expanded from macro
'unsafe_put_user'
#define unsafe_put_user(x, p, e) __put_user_goto(x, p, e)
^
../arch/powerpc/include/asm/uaccess.h:98:2: note: expanded from macro
'__put_user_goto'
__put_user_nocheck_goto((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr)),
label)
^
../arch/powerpc/include/asm/uaccess.h:295:2: note: expanded from macro
'__put_user_nocheck_goto'
__put_user_size_goto((x), __pu_addr, (size), label); \
^
../arch/powerpc/include/asm/uaccess.h:284:10: note: expanded from macro
'__put_user_size_goto'
case 8: __put_user_asm2_goto(x, ptr, label); break; \
^
../arch/powerpc/include/asm/uaccess.h:268:3: note: expanded from macro
'__put_user_asm2_goto'
"1: stw%X1 %0, %1\n" \
^
2 errors generated.
Reducing it down with cvise spits out:
$ cat readdir.i
int a;
void b() {
__typeof__(a) c;
asm goto("2: stw%X1 %L0, %L1\n" : : "r"(0), "m"(c) : : d);
d:;
}
$ clang --target=powerpc-linux-gnu --prefix=${CBL}/toolchains/binutils/bin/
--gcc-toolchain=${CBL}/toolchains/binutils/ -no-integrated-as -m32 -mbig-endian
-O2 -c -o /dev/null readdir.i
readdir.i:4:12: error: invalid operand in inline asm: '2: stw${1:X}
${0:L}, ${1:L}'
asm goto("2: stw%X1 %L0, %L1\n" : : "r"(0), "m"(c) : : d);
^
readdir.i:4:12: error: invalid operand in inline asm: '2: stw${1:X}
${0:L}, ${1:L}'
2 errors generated.
$ clang --target=powerpc-linux-gnu -m32 -mbig-endian -O2 -c -o /dev/null
readdir.
readdir.i:4:12: error: invalid operand in inline asm: '2: stw${1:X}
${0:L}, ${1:L}'
asm goto("2: stw%X1 %L0, %L1\n" : : "r"(0), "m"(c) : : d);
^
readdir.i:4:12: error: invalid operand in inline asm: '2: stw${1:X}
${0:L}, ${1:L}'
readdir.i:4:12: error: unknown operand
<inline asm>:1:9: note: instantiated into assembly here
2: stw ,
^
3 errors generated.
$ powerpc-linux-gcc -m32 -mbig-endian -O2 -c readdir.i
$ echo $?
0
Full files available here:
<a href="https://github.com/nathanchance/creduce-files/tree/f91938b8d1a5ace818c0be8c649d806730d9c702/334710b1496af8a0960e70121f850e209c20958f">https://github.com/nathanchance/creduce-files/tree/f91938b8d1a5ace818c0be8c649d806730d9c702/334710b1496af8a0960e70121f850e209c20958f</a></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>