summaryrefslogtreecommitdiff
path: root/gcc/config/rs6000/rs6000.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/rs6000/rs6000.cc')
-rw-r--r--gcc/config/rs6000/rs6000.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index ceaddafd33b..bc619592b9e 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -25678,11 +25678,20 @@ rs6000_sibcall_aix (rtx value, rtx func_desc, rtx tlsarg, rtx cookie)
rtx r12 = NULL_RTX;
rtx func_addr = func_desc;
- gcc_assert (INTVAL (cookie) == 0);
-
if (global_tlsarg)
tlsarg = global_tlsarg;
+ /* Handle longcall attributes. */
+ if (INTVAL (cookie) & CALL_LONG && SYMBOL_REF_P (func_desc))
+ {
+ /* PCREL can do a sibling call to a longcall function
+ because we don't need to restore the TOC register. */
+ gcc_assert (rs6000_pcrel_p ());
+ func_desc = rs6000_longcall_ref (func_desc, tlsarg);
+ }
+ else
+ gcc_assert (INTVAL (cookie) == 0);
+
/* For ELFv2, r12 and CTR need to hold the function address
for an indirect call. */
if (GET_CODE (func_desc) != SYMBOL_REF && DEFAULT_ABI == ABI_ELFv2)