[llvm-bugs] [Bug 34715] New: compiler-rt builtins are broken for thumb
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Sep 24 16:11:22 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34715
Bug ID: 34715
Summary: compiler-rt builtins are broken for thumb
Product: compiler-rt
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: compiler-rt
Assignee: unassignedbugs at nondot.org
Reporter: manojgupta at google.com
CC: compnerd at compnerd.org, efriedma at codeaurora.org,
llozano at chromium.org, llvm-bugs at lists.llvm.org,
peter.smith at linaro.org, pirama at google.com,
srhines at google.com, weimingz at codeaurora.org
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170924/e3164efd/attachment.html>
More information about the llvm-bugs
mailing list