On Fri, Jan 12, 2018 at 9:59 AM, Jan Hubicka <hubi...@ucw.cz> wrote: >> Add -mindirect-branch-register to force indirect branch via register. >> This is implemented by disabling patterns of indirect branch via memory, >> similar to TARGET_X32. >> >> -mindirect-branch= and -mfunction-return= tests are updated with >> -mno-indirect-branch-register to avoid false test failures when >> -mindirect-branch-register is added to RUNTESTFLAGS for "make check". >> >> gcc/ >> >> * config/i386/constraints.md (Bs): Disallow memory operand for >> -mindirect-branch-register. >> (Bw): Likewise. >> * config/i386/predicates.md (indirect_branch_operand): Likewise. >> (GOT_memory_operand): Likewise. >> (call_insn_operand): Likewise. >> (sibcall_insn_operand): Likewise. >> (GOT32_symbol_operand): Likewise. >> * config/i386/i386.md (indirect_jump): Call convert_memory_address >> for -mindirect-branch-register. >> (tablejump): Likewise. >> (*sibcall_memory): Likewise. >> (*sibcall_value_memory): Likewise. >> Disallow peepholes of indirect call and jump via memory for >> -mindirect-branch-register. >> (*call_pop): Replace m with Bw. >> (*call_value_pop): Likewise. >> (*sibcall_pop_memory): Replace m with Bs. >> * config/i386/i386.opt (mindirect-branch-register): New option. >> * doc/invoke.texi: Document -mindirect-branch-register option. >> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi >> index df945989fe8..d16006e653a 100644 >> --- a/gcc/doc/invoke.texi >> +++ b/gcc/doc/invoke.texi >> @@ -1230,7 +1230,8 @@ See RS/6000 and PowerPC Options. >> -mstack-protector-guard-offset=@var{offset} @gol >> -mstack-protector-guard-symbol=@var{symbol} -mmitigate-rop @gol >> -mgeneral-regs-only -mcall-ms2sysv-xlogues @gol >> --mindirect-branch=@var{choice} -mfunction-return==@var{choice}} >> +-mindirect-branch=@var{choice} -mfunction-return==@var{choice} @gol >> +-mindirect-branch-register} >> >> @emph{x86 Windows Options} >> @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol >> @@ -26861,6 +26862,10 @@ object file. You can control this behavior for a >> specific function by >> using the function attribute @code{function_return}. >> @xref{Function Attributes}. >> >> +@item -mindirect-branch-register >> +@opindex -mindirect-branch-register >> +Force indirect call and jump via register. > > Again I think this option needs better documentation. It is not quite clear > to me why > it is needed at first place? >
This is used by kernel to force__x86_indirect_thunk_reg. Do we need this info in GCC manual? -- H.J.