Index: lld/ELF/Relocations.cpp =================================================================== --- lld/ELF/Relocations.cpp +++ lld/ELF/Relocations.cpp @@ -663,6 +663,10 @@ Msg += Src + "\n>>> "; Msg += Sec.getObjMsg(Offset); + if (Sym.getName().startswith("_ZTV")) + Msg += "\nthe vtable symbol may be undefined because the class is " + "missing its key function"; + if ((Config->UnresolvedSymbols == UnresolvedPolicy::Warn && CanBeExternal) || Config->NoinhibitExec) { warn(Msg); Index: lld/test/ELF/undef.s =================================================================== --- lld/test/ELF/undef.s +++ lld/test/ELF/undef.s @@ -20,6 +20,9 @@ # CHECK: >>> referenced by undef.s # CHECK: >>> {{.*}}:(.text+0x10) +# CHECK: error: undefined symbol: vtable for Foo +# CHECK: the vtable symbol may be undefined because the class is missing its key function + # CHECK: error: undefined symbol: zed2 # CHECK: >>> referenced by {{.*}}.o:(.text+0x0) in archive {{.*}}2.a @@ -60,3 +63,4 @@ call bar call zed1 call _Z3fooi + call _ZTV3Foo