diff --git a/sysdeps/powerpc/powerpc64/crti.S b/sysdeps/powerpc/powerpc64/crti.S index 71bdddfb3b..e977bc4b9c 100644 --- a/sysdeps/powerpc/powerpc64/crti.S +++ b/sysdeps/powerpc/powerpc64/crti.S @@ -68,6 +68,9 @@ BODY_LABEL (_init): LOCALENTRY(_init) mflr 0 std 0, FRAME_LR_SAVE(r1) +#ifdef __ROP_PROTECT__ + hashst 0, FRAME_ROP_SAVE(r1) +#endif stdu r1, -FRAME_MIN_SIZE_PARM(r1) #if PREINIT_FUNCTION_WEAK addis r9, r2, .LC0@toc@ha @@ -87,4 +90,7 @@ BODY_LABEL (_fini): LOCALENTRY(_fini) mflr 0 std 0, FRAME_LR_SAVE(r1) +#ifdef __ROP_PROTECT__ + hashst 0, FRAME_ROP_SAVE(r1) +#endif stdu r1, -FRAME_MIN_SIZE_PARM(r1) diff --git a/sysdeps/powerpc/powerpc64/crtn.S b/sysdeps/powerpc/powerpc64/crtn.S index 4e91231f2c..a37e159950 100644 --- a/sysdeps/powerpc/powerpc64/crtn.S +++ b/sysdeps/powerpc/powerpc64/crtn.S @@ -42,10 +42,16 @@ addi r1, r1, FRAME_MIN_SIZE_PARM ld r0, FRAME_LR_SAVE(r1) mtlr r0 +#ifdef __ROP_PROTECT__ + hashchk 0, FRAME_ROP_SAVE(r1) +#endif blr .section .fini,"ax",@progbits addi r1, r1, FRAME_MIN_SIZE_PARM ld r0, FRAME_LR_SAVE(r1) mtlr r0 +#ifdef __ROP_PROTECT__ + hashchk 0, FRAME_ROP_SAVE(r1) +#endif blr diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h index c439b06121..b5c70e526e 100644 --- a/sysdeps/powerpc/powerpc64/sysdep.h +++ b/sysdeps/powerpc/powerpc64/sysdep.h @@ -31,8 +31,9 @@ #define FRAME_TOC_SAVE 40 #define FRAME_PARM_SAVE 48 #else +#define FRAME_ROP_SAVE -8 #define FRAME_MIN_SIZE 32 -#define FRAME_MIN_SIZE_PARM 96 +#define FRAME_MIN_SIZE_PARM 112 /* Includes space for the ROP save slot */ #define FRAME_TOC_SAVE 24 #define FRAME_PARM_SAVE 32 #endif