I have built gcc-7.4.0 with --enable-vtable-verify for x86_64 under Fedora 27: $HOME/src/gcc-7.4.0/configure --srcdir=$HOME/src/gcc-7.4.0 --verbose --enable-vtable-verify --enable-languages=c,c++,fortran --enable-lto --prefix=$HOME/local-gcc When I run: $ ~/local-gcc/bin/g++ -fvtable-verify=std -O2 -static t.C -o t.exe the following error occurs: ~/local-gcc/lib/gcc/x86_64-pc-linux-gnu/7.4.0/vtv_end.o: In function `__VLTprotect': vtv_end.c:(.text.startup+0x0): multiple definition of `__VLTprotect' ~/local-gcc/lib/gcc/x86_64-pc-linux-gnu/7.4.0/../../../../lib64/libvtv.a(vtv_end.o):~/build/native-gcc/x86_64-pc-linux-gnu/libvtv/vtv_end.c:59: first defined here $ cat t.C int main () {return 0;} I have fixed the problem by deleting vtv_end.o from ~/local-gcc/lib64/libvtv.a but I'm not sure it's OK.
I've also noticed that small programs (tests) built with "vtable-verify enabled" gcc work slower than programs built with default gcc (even when the -fvtable-verify option is not used). This slowdown mostly concerns dynamically linked programs.
cc-ing libvtv maintainer
Likely #define GNU_USER_TARGET_STARTFILE_SPEC \ ... %{fvtable-verify=none:%s; \ fvtable-verify=preinit:vtv_start_preinit.o%s; \ fvtable-verify=std:vtv_start.o%s} " \ should either be conditional on !static or indeed the copy removed from the static libvtv.
I would prefer that we make it condition on !static, rather than removing it. I will work on a patch for that.
Author: ctice Date: Tue Aug 13 16:11:20 2019 New Revision: 274386 URL: https://gcc.gnu.org/viewcvs?rev=274386&root=gcc&view=rev Log: Fix PR other/91396 static linke error with -fvtable-verify Fix a bug where linking with -fvtable-verify and -static causes the linker to complain about multiple definitions of things in the vtv_end*.o files (once from the .o file and once from libvtv.a). 2019-08-12 Caroline Tice <cmtice@google.com> PR other/91396 * config/gnu-user.h (GNU_USER_TARGET_ENDFILE_SPEC): Only add the vtv_end.o or vtv_end_preinit.o files if !static. Modified: trunk/gcc/ChangeLog trunk/gcc/config/gnu-user.h
(In reply to ctice from comment #5) > Author: ctice > Date: Tue Aug 13 16:11:20 2019 > New Revision: 274386 > > URL: https://gcc.gnu.org/viewcvs?rev=274386&root=gcc&view=rev > Log: > Fix PR other/91396 static linke error with -fvtable-verify > > Fix a bug where linking with -fvtable-verify and > -static causes the linker to complain about multiple definitions of > things in the vtv_end*.o files (once from the .o file and once from > libvtv.a). > > 2019-08-12 Caroline Tice <cmtice@google.com> > > PR other/91396 > * config/gnu-user.h (GNU_USER_TARGET_ENDFILE_SPEC): Only add the > vtv_end.o or vtv_end_preinit.o files if !static. > > > > Modified: > trunk/gcc/ChangeLog > trunk/gcc/config/gnu-user.h Did this fix it?
To the best of my knowledge this is fixed; do you have evidence otherwise?
(In reply to ctice from comment #7) > To the best of my knowledge this is fixed; do you have evidence otherwise? Nope, just wanted to make sure I could close this.
I have built gcc-9.2.0 with --enable-vtable-verify for x86_64 under Fedora 22 with the correction https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=274386 Linking with -fvtable-verify and -static is now ok, thank you.