<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 - compiler-rt builtins are broken for thumb"
href="https://bugs.llvm.org/show_bug.cgi?id=34715">34715</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>compiler-rt builtins are broken for thumb
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>compiler-rt
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>manojgupta@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>compnerd@compnerd.org, efriedma@codeaurora.org, llozano@chromium.org, llvm-bugs@lists.llvm.org, peter.smith@linaro.org, pirama@google.com, srhines@google.com, weimingz@codeaurora.org
</td>
</tr></table>
<p>
<div>
<pre>Many Compiler-rt ARM asm builtins are missing .thumb declaration. As a result,
they are compiled in ARM mode.
r310884 forced function declaration to be thumb when the thumb state is
supported.
This created a mismatch in generated code where the encoding is done in ARM
mode but function is marked as a thumb function.
#define DEFINE_COMPILERRT_FUNCTION(name)
\
FILE_LEVEL_DIRECTIVE SEPARATOR
\
.globl SYMBOL_NAME(name) SEPARATOR
\
SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR
\
DECLARE_SYMBOL_VISIBILITY(name)
\
+ DECLARE_FUNC_ENCODING // This forces function to be declared as a
thumb function \
SYMBOL_NAME(name):
e.g.
$ clang -Qunused-arguments -pie -mthumb -DVISIBILITY_HIDDEN -O2 -pipe
-rtlib=libgcc -fomit-frame-pointer -mfpu=vfpv3 -march=armv7-a -mfloat-abi=hard
-fno-lto -std=c11 -fPIC -fno-builtin -fvisibility=hidden
-DCOMPILER_RT_ARMHF_TARGET -o adddf3vfp.S.o -c
work/compiler-rt/lib/builtins/arm/adddf3vfp.S -target
armv7a-cros-linux-gnueabihf -mfloat-abi=hard
$ arm-linux-gnueabihf-objdump -d adddf3vfp.S.o
Disassembly of section .text:
00000000 <__adddf3vfp>:
0: ee300b01 vadd.f64 d0, d0, d1 // These are ARM
instructions, not thumb/thumb2
4: e12fff1e bx lr
$ readelf -s adddf3vfp.S.o
Previous:
Symbol table '.symtab' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE LOCAL DEFAULT 2 $a.0
2: 00000000 8 FUNC GLOBAL HIDDEN 2 __adddf3vfp
After r310884:
Symbol table '.symtab' contains 3 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 00000000 0 NOTYPE LOCAL DEFAULT UND
1: 00000000 0 NOTYPE LOCAL DEFAULT 2 $a.0
2: 00000001 8 FUNC GLOBAL HIDDEN 2 __adddf3vfp // Note the
difference in the field Value
Because of this, linker think __adddf3vfp is a thumb function but the encoding
uses arm format.</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>