https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659
--- Comment #4 from Rafael Avila de Espindola <rafael.espindola at gmail dot com> --- I ran the testcase with just -O2 (original code with -O3, but the reduced testcase with -O2). getOption will be part of the vtable, but it can end up being hidden. In the original source code it ends up being hidden because of -fvisibility-inlines-hidden (I think, haven't checked). It also seems invalid to produce the extra undefined at a more fundamental level. The ABI doesn't say that symbol has to be exposed. In particular, the vtable can be in another DSO and it is legal to remeve the symbol of getOption from the dso since the compiler knows that any user can emit a copy. The above optimization is why PREVAILING_DEF_IRONLY_EXP was added to the gold plugin api and both gcc and llvm LTO's optimizations do it. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53808 for a related discussion.