https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84066
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-01-29
Ever confirmed|0 |1
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to igor.v.tsimbalist from comment #1)
> Created attachment 43274 [details]
> x32 patch
machine_mode mode;
- mem = gen_rtx_MEM (Pmode, plus_constant (Pmode, operands[0],
- 3 * GET_MODE_SIZE (Pmode)));
- reg_ssp = gen_reg_rtx (Pmode);
+ mode = (TARGET_X32 || TARGET_64BIT) ? DImode : SImode;
Just replace Pmode with word_mode and use word_mode to save/restore
SSP. Please also add comments to show why it is needed:
x32 is a 64-bit process with 32-bit software pointer and kernel may
place x32 shadow stack above 4GB. We need to save and restore 64-bit
shadow stack register for x32
and why it is OK:
builtin jmp buf size is 5 pointers. We have space to save 64-bit
shadow stack pointers: 32-bit SP, 32-bit FP, 32-bit IP, 64-bit SSP
for x32.