Vtable verification currently does not work properly with LTO. Fixing this will be non-trivial, and I currently do not have the time do this. Until this can be fixed, we should not allow users to specify both vtable verification and link-time optimization. The attached patch checks to see if both options were specified and if so, tells the user that this is not supported.
I have tested this by compiling hello world with each option separately and then trying to specify them both; it behaves as expected. Is this patch OK to commit? -- Caroline Tice cmt...@google.com ChangeLog entry: 2019-09-04 Caroline Tice <cmt...@google.com> * opts.c (finish_options): Disallow -fvtable-verify and -flto to be specified together; Index: gcc/opts.c =================================================================== --- gcc/opts.c (revision 275387) +++ gcc/opts.c (working copy) @@ -1226,6 +1226,10 @@ if (opts->x_flag_live_patching && opts->x_flag_lto) sorry ("live patching is not supported with LTO"); + /* Currently vtable verification is not supported for LTO */ + if (opts->x_flag_vtable_verify && opts->x_flag_lto) + sorry ("vtable verification is not supported with LTO"); + /* Control IPA optimizations based on different -flive-patching level. */ if (opts->x_flag_live_patching) {