summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-06-27 12:33:33 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-06-27 12:33:33 +0000
commitb2b6a8580cb04fa853c3c67a7ce0f6392946343d (patch)
tree49beb333676dc38dcfcd65e567e0a0d04cb4c6e2 /llvm/lib/Target/Mips
parent728cf09b0e0b4fe6eb96c2b238a99e6b79040776 (diff)
downloadbcm5719-llvm-b2b6a8580cb04fa853c3c67a7ce0f6392946343d.tar.gz
bcm5719-llvm-b2b6a8580cb04fa853c3c67a7ce0f6392946343d.zip
Add an explanation on how mips is special in here.
llvm-svn: 273868
Diffstat (limited to 'llvm/lib/Target/Mips')
-rw-r--r--llvm/lib/Target/Mips/MipsISelLowering.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp
index 1e640e17379..ac2ed5028bd 100644
--- a/llvm/lib/Target/Mips/MipsISelLowering.cpp
+++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp
@@ -1764,6 +1764,17 @@ SDValue MipsTargetLowering::lowerGlobalAddress(SDValue Op,
return getAddrNonPIC(N, SDLoc(N), Ty, DAG);
}
+ // Every other architecture would use shouldAssumeDSOLocal in here, but
+ // mips is special.
+ // * In PIC code mips requires got loads oven for local statics!
+ // * To save on got entries, for local statics the got entry contains the
+ // page and an additional add instruction takes care of the low bits.
+ // * It is legal to access a hidden symbol with a non hidden undefined,
+ // so one cannot guarantee that all access to a hidden symbol will know
+ // it is hidden.
+ // * Mips linkers don't support creating a page and a full got entry for
+ // the same symbol.
+ // * Given all that, we have to use a full got entry for hidden symbols :-(
if (GV->hasLocalLinkage())
return getAddrLocal(N, SDLoc(N), Ty, DAG, ABI.IsN32() || ABI.IsN64());
OpenPOWER on IntegriCloud