diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2022-01-05 18:04:21 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2022-01-06 11:35:11 -0800 |
commit | c2e5c4feed32c808591b5278f680bbabe63eb225 (patch) | |
tree | 04924a17df4284048085cd7622b0f440585fdd9f /gcc/config/i386 | |
parent | ed8060950c64f2e449aaf90e438aa26d0d9d0b31 (diff) | |
download | gcc-c2e5c4feed32c808591b5278f680bbabe63eb225.zip gcc-c2e5c4feed32c808591b5278f680bbabe63eb225.tar.gz gcc-c2e5c4feed32c808591b5278f680bbabe63eb225.tar.bz2 |
x86: Generate INT3 for __builtin_eh_return
Generate INT3 after indirect jmp in exception return for -fcf-protection
with -mharden-sls=indirect-jmp.
gcc/
PR target/103925
* config/i386/i386.c (ix86_output_indirect_function_return):
Generate INT3 after indirect jmp for -mharden-sls=indirect-jmp.
gcc/testsuite/
PR target/103925
* gcc.target/i386/harden-sls-6.c: New test.
Diffstat (limited to 'gcc/config/i386')
-rw-r--r-- | gcc/config/i386/i386.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 7365775..c4ed82d 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -16382,11 +16382,14 @@ ix86_output_indirect_function_return (rtx ret_op) } else output_indirect_thunk (regno); - - return ""; } else - return "%!jmp\t%A0"; + { + output_asm_insn ("%!jmp\t%A0", &ret_op); + if (ix86_harden_sls & harden_sls_indirect_jmp) + fputs ("\tint3\n", asm_out_file); + } + return ""; } /* Output the assembly for a call instruction. */ |