CFI-icall on Thumb
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 8 Dec 2016 00:32:26 +0000 (00:32 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 8 Dec 2016 00:32:26 +0000 (00:32 +0000)
commit0c8957c19834485c13a3c93b7c8661b594e33714
tree1e3145f1773614aa0185892a91b353f5fbe8b28e
parentcfef0cd31b5b1396048a231d6c8387e8c785474c
CFI-icall on Thumb

Replace @progbits in the section directive with %progbits, because "@" starts a comment on arm/thumb.
Use b.w branch instruction.
Use .thumb_function and .thumb_set for proper arm/thumb interwork. This way jumptable entry addresses on thumb have bit 0 set (correctly). This does not affect CFI check math, because the address of the jumptable start also has that bit set.

This does not work on thumbv5, because it does not support b.w, and the linker would not insert a veneer (trampoline?) to extend the range of b.n. We may need to do full-range plt-style jumptables on thumbv54, which are 12 bytes per entry. Another option is "push lr; bl; pop pc" (4 bytes) but that needs unwinding instructions, etc.

Differential Revision: https://reviews.llvm.org/D27499

llvm-svn: 289008
llvm/lib/Transforms/IPO/LowerTypeTests.cpp
llvm/test/Transforms/LowerTypeTests/function.ll