[PATCH] D26045: [cfi] Fix weak functions handling.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 15:31:40 PDT 2016


eugenis created this revision.
eugenis added a reviewer: pcc.
eugenis added a subscriber: llvm-commits.
eugenis set the repository for this revision to rL LLVM.

When a function pointer is replaced with a jumptable pointer, special
case is needed to preserve the semantics of extern_weak functions.
Since a jumptable entry can not be extern_weak, we emulate that
behaviour by replacing all references to F (the extern_weak function)
with the following expression: F != nullptr ? JumpTablePtr : nullptr.

Extra special care is needed for global initializers, since most (or
probably all) backends can not lower an initializer that includes
this kind of constant expression. Initializers like that are replaced
with a global constructor (i.e. a runtime initializer).


Repository:
  rL LLVM

https://reviews.llvm.org/D26045

Files:
  lib/Transforms/IPO/LowerTypeTests.cpp
  test/Transforms/LowerTypeTests/function-weak.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26045.76116.patch
Type: text/x-patch
Size: 6739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161027/0766e1d7/attachment.bin>


More information about the llvm-commits mailing list