> > 2018-11-20 qing zhao <qing.zhao@xxxxxxxxxx> > > * cif-code.def (EXTERN_LIVE_ONLY_STATIC): New CIF code. > * common.opt: Add -flive-patching flag. > * doc/invoke.texi: Document -flive-patching. > * flag-types.h (enum live_patching_level): New enum. > * ipa-inline.c (can_inline_edge_p): Disable external functions from > inlining when flag_live_patching is LIVE_PATCHING_INLINE_ONLY_STATIC. > * opts.c (control_options_for_live_patching): New function. > (finish_options): Make flag_live_patching incompatible with flag_lto. > Control IPA optimizations based on different levels of > flag_live_patching. > > gcc/testsuite/ChangeLog: > > 2018-11-20 qing zhao <qing.zhao@xxxxxxxxxx> > > * gcc.dg/live-patching-1.c: New test. > * gcc.dg/live-patching-2.c: New test. > * gcc.dg/live-patching-3.c: New test. > * gcc.dg/tree-ssa/writeonly-3.c: New test. > * gcc.target/i386/ipa-stack-alignment-2.c: New test. > I am still somewhat worried about possible use with C++ programs where we will kill all inlining of comdats, but I guess we could discuss that when it becomes an issue. + + /* FIXME: disable unreachable code removal. */ Disabling unreachable code removal will really introduce a lot of extra dead code, can't live patches just provide what they need if the code was earlier removed. + + /* discovery of functions/variables with no address taken. */ + if (opts_set->x_flag_ipa_reference_addressable + && opts->x_flag_ipa_reference_addressable) + error_at (loc, + "%<-fipa-reference-addressable%> is incompatible with " + "%<-flive-patching=inline-only-static|inline-clone%>"); + else + opts->x_flag_ipa_reference_addressable = 0; + + /* ipa stack alignment propagation. */ + if (opts_set->x_flag_ipa_stack_alignment + && opts->x_flag_ipa_stack_alignment) + error_at (loc, + "%<-fipa-stack-alignment%> is incompatible with " + "%<-flive-patching=inline-only-static|inline-clone%>"); + else + opts->x_flag_ipa_stack_alignment = 0; Shall we also disable nothrow or we will worry about C++ only ter? Patch is OK, thanks! Honza