summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-03-07 15:45:40 +0000
committerDuncan Sands <baldrick@free.fr>2009-03-07 15:45:40 +0000
commit12da8ce3d2b9c365b2e204fcf2b4002177fc6b8b (patch)
tree023775b45b2c7ece7e0bb33e31414f4fc7b6efa2 /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
parentc61149d79656faa7822c32d34f36726e623bf704 (diff)
downloadbcm5719-llvm-12da8ce3d2b9c365b2e204fcf2b4002177fc6b8b.tar.gz
bcm5719-llvm-12da8ce3d2b9c365b2e204fcf2b4002177fc6b8b.zip
Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr. These are the same as the non-odr versions, except that they indicate that the global will only be overridden by an *equivalent* global. In C, a function with weak linkage can be overridden by a function which behaves completely differently. This means that IP passes have to skip weak functions, since any deductions made from the function definition might be wrong, since the definition could be replaced by something completely different at link time. This is not allowed in C++, thanks to the ODR (One-Definition-Rule): if a function is replaced by another at link-time, then the new function must be the same as the original function. If a language knows that a function or other global can only be overridden by an equivalent global, it can give it the weak_odr linkage type, and the optimizers will understand that it is alright to make deductions based on the function body. The code generators on the other hand map weak and weak_odr linkage to the same thing. llvm-svn: 66339
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 7913c019631..a08dcb2e49d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -728,7 +728,7 @@ TargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const {
if (getTargetMachine().getRelocationModel() == Reloc::DynamicNoPIC &&
GA &&
!GA->getGlobal()->isDeclaration() &&
- !GA->getGlobal()->mayBeOverridden())
+ !GA->getGlobal()->isWeakForLinker())
return true;
// Otherwise assume nothing is safe.
OpenPOWER on IntegriCloud