https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70216
--- Comment #6 from Oleg Endo <olegendo at gcc dot gnu.org> --- Created attachment 38083 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38083&action=edit Proposed patch This patch adds two new target options: -msh4-trapa-sleep-bug -mbuiltin-trap= and two configure options: --with-builtin-trap --enable-sh4-trapa-sleep-bug / --disable-sh4-trapa-sleep-bug On sh*-linux it should configure itself to use -mbuiltin-trap=trapa,imm=84 by default. I'm not sure if the -msh4-trapa-sleep-bug should be enabled by default on sh*-linux to always emit the workaround insn sequence (trap + 5x or r0,r0). If --enable-sh4-trapa-sleep-bug is not specified, it will only be enabled when compiling code for SH4.