aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2021-09-08 13:10:30 +0000
committerSegher Boessenkool <segher@kernel.crashing.org>2021-09-08 13:27:56 +0000
commit86e6268cff328e27ee6f90e2afc35b6f437a25cd (patch)
treec688e92dabb1bb4277f4744909f3fed3e83cd1c0
parent7485a52551d71db2e8bbfc4c484196bcc321a1cd (diff)
downloadgcc-86e6268cff328e27ee6f90e2afc35b6f437a25cd.zip
gcc-86e6268cff328e27ee6f90e2afc35b6f437a25cd.tar.gz
gcc-86e6268cff328e27ee6f90e2afc35b6f437a25cd.tar.bz2
rs6000: Fix ELFv2 r12 use in epilogue
We cannot use r12 here, it is already in use as the GEP (for sibling calls). 2021-09-08 Segher Boessenkool <segher@kernel.crashing.org> PR target/102107 * config/rs6000/rs6000-logue.c (rs6000_emit_epilogue): For ELFv2 use r11 instead of r12 for restoring CR.
-rw-r--r--gcc/config/rs6000/rs6000-logue.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/config/rs6000/rs6000-logue.c b/gcc/config/rs6000/rs6000-logue.c
index e363d56..9965a8aa 100644
--- a/gcc/config/rs6000/rs6000-logue.c
+++ b/gcc/config/rs6000/rs6000-logue.c
@@ -4815,6 +4815,10 @@ rs6000_emit_epilogue (enum epilogue_type epilogue_type)
else if (REGNO (frame_reg_rtx) == 12)
cr_save_regno = 11;
+ /* For ELFv2 r12 is already in use as the GEP. */
+ if (DEFAULT_ABI == ABI_ELFv2)
+ cr_save_regno = 11;
+
cr_save_reg = load_cr_save (cr_save_regno, frame_reg_rtx,
info->cr_save_offset + frame_off,
exit_func);