[PATCH] D33999: Refine the condition for when to use CALL16 vs a GOT displacement.

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 03:11:24 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL306387: [mips] Refine the condition for when to use CALL16 vs a GOT displacement. (authored by sdardis).

Changed prior to commit:
  https://reviews.llvm.org/D33999?vs=101761&id=104118#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33999

Files:
  llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp


Index: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -2808,8 +2808,12 @@
     // symbol in the final relocation is external and not modified with a
     // constant then we must use R_MIPS_CALL16 instead of R_MIPS_GOT16.
     if ((DstReg == Mips::T9 || DstReg == Mips::T9_64) && !UseSrcReg &&
-        Res.getConstant() == 0 && !Res.getSymA()->getSymbol().isInSection() &&
-        !Res.getSymA()->getSymbol().isTemporary()) {
+        Res.getConstant() == 0 &&
+        !(Res.getSymA()->getSymbol().isInSection() ||
+          Res.getSymA()->getSymbol().isTemporary() ||
+          (Res.getSymA()->getSymbol().isELF() &&
+           cast<MCSymbolELF>(Res.getSymA()->getSymbol()).getBinding() ==
+               ELF::STB_LOCAL))) {
       const MCExpr *CallExpr =
           MipsMCExpr::create(MipsMCExpr::MEK_GOT_CALL, SymExpr, getContext());
       TOut.emitRRX(Mips::LW, DstReg, ABI.GetGlobalPtr(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33999.104118.patch
Type: text/x-patch
Size: 1100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170627/648f77db/attachment.bin>


More information about the llvm-commits mailing list