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: unassignedb...@nondot.org
Reporter: manojgu...@google.com
CC: compn...@compnerd.org, efrie...@codeaurora.org,
lloz...@chromium.org, llvm-bugs@lists.llvm.org,
peter.sm...@linaro.org, pir...@google.com,
srhi...@google.com, weimi...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs