summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorBhushan D. Attarde <Bhushan.Attarde@imgtec.com>2016-01-12 03:48:43 +0000
committerBhushan D. Attarde <Bhushan.Attarde@imgtec.com>2016-01-12 03:48:43 +0000
commitdef5e7df768eede110a18df73dac103818eab0a3 (patch)
tree25bafc87fa82f775819fd6c95cf62091bba5cab7 /lldb
parent1a427287192dfadf17c6df2e092ba38bc7264c1c (diff)
downloadbcm5719-llvm-def5e7df768eede110a18df73dac103818eab0a3.tar.gz
bcm5719-llvm-def5e7df768eede110a18df73dac103818eab0a3.zip
[LLDB][MIPS] Handle PIC calling convention for MIPS64
SUMMARY: This patch sets up register r25 with the address of function to be called in PrepareTrivialCall(). This is required as per MIPS PIC calling convention. Reviewers: clayborg Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits Differential Revision: http://reviews.llvm.org/D16046 llvm-svn: 257441
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
index bc62c9fe82e..e3da3631723 100644
--- a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
@@ -206,6 +206,7 @@ ABISysV_mips64::PrepareTrivialCall (Thread &thread,
const RegisterInfo *pc_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC);
const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP);
const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA);
+ const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", 0);
if (log)
log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp);
@@ -228,6 +229,13 @@ ABISysV_mips64::PrepareTrivialCall (Thread &thread,
if (!reg_ctx->WriteRegisterFromUnsigned (pc_reg_info, func_addr))
return false;
+ if (log)
+ log->Printf("Writing r25: 0x%" PRIx64, (uint64_t)func_addr);
+
+ // All callers of position independent functions must place the address of the called function in t9 (r25)
+ if (!reg_ctx->WriteRegisterFromUnsigned (r25_info, func_addr))
+ return false;
+
return true;
}
OpenPOWER on IntegriCloud