diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2016-04-22 20:40:10 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-04-22 20:40:10 +0000 |
| commit | 265ebd7d70496049d49021b4eb5eabffcf291b7d (patch) | |
| tree | 4812863753534f9ff90358e0e120efa8bbcac6b8 /llvm/lib/Analysis | |
| parent | eedef73b633496ca52af265b472519f0e385a7d2 (diff) | |
| download | bcm5719-llvm-265ebd7d70496049d49021b4eb5eabffcf291b7d.tar.gz bcm5719-llvm-265ebd7d70496049d49021b4eb5eabffcf291b7d.zip | |
CodeGen: Use PLT relocations for relative references to unnamed_addr functions.
The relative vtable ABI (PR26723) needs PLT relocations to refer to virtual
functions defined in other DSOs. The unnamed_addr attribute means that the
function's address is not significant, so we're allowed to substitute it
with the address of a PLT entry.
Also includes a bonus feature: addends for COFF image-relative references.
Differential Revision: http://reviews.llvm.org/D17938
llvm-svn: 267211
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/ConstantFolding.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp index d87a0800262..ebe8a27999f 100644 --- a/llvm/lib/Analysis/ConstantFolding.cpp +++ b/llvm/lib/Analysis/ConstantFolding.cpp @@ -231,10 +231,12 @@ Constant *FoldBitCast(Constant *C, Type *DestTy, const DataLayout &DL) { return ConstantVector::get(Result); } +} // end anonymous namespace + /// If this constant is a constant offset from a global, return the global and /// the constant. Because of constantexprs, this function is recursive. -bool IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, APInt &Offset, - const DataLayout &DL) { +bool llvm::IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, + APInt &Offset, const DataLayout &DL) { // Trivial case, constant is the global. if ((GV = dyn_cast<GlobalValue>(C))) { unsigned BitWidth = DL.getPointerTypeSizeInBits(GV->getType()); @@ -271,6 +273,8 @@ bool IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, APInt &Offset, return true; } +namespace { + /// Recursive helper to read bits out of global. C is the constant being copied /// out of. ByteOffset is an offset into C. CurPtr is the pointer to copy /// results into and BytesLeft is the number of bytes left in |

