* [PATCH] libgcc: Add support for --disable-libgcov @ 2018-05-25 13:06 Rasmus Villemoes 2018-05-25 16:40 ` Joseph Myers 0 siblings, 1 reply; 8+ messages in thread From: Rasmus Villemoes @ 2018-05-25 13:06 UTC (permalink / raw) To: gcc-patches; +Cc: Rasmus Villemoes When trying to build gcc 6.4.0 targeting VxWorks 5.5, I ran into libgcov not building against the VxWorks system headers - there are multiple issues such as gcc-src/libgcc/../gcc/gcov-io.c:78:3: warning: implicit declaration of function 'getpid' [-Wimplicit-function-declaration] s_flock.l_pid = getpid (); ^ gcc-src/libgcc/libgcov.c:139:9: warning: implicit declaration of function 'access' [-Wimplicit-function-declaration] if (access (filename, F_OK) == -1 ^ gcc-src/libgcc/libgcov.c:139:31: error: 'F_OK' undeclared (first use in this function) if (access (filename, F_OK) == -1 ^ Moreover, from the gcov documentation, it would seem to be cumbersome at best to actually use it on VxWorks. So add an option for disabling build and install of libgcov. It would probably be most user-friendly if the resulting compiler would reject --coverage and -fprofile-arcs, but I couldn't find an easy way to do that. 2018-05-25 Rasmus Villemoes <rasmus.villemoes@prevas.dk> libgcc/ * Makefile.in: Honour @enable_libgcov@ * configure.ac: Add --disable-libgcov option * configure: Regenerate. --- libgcc/Makefile.in | 8 +++++++- libgcc/configure.ac | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index dd8cee99fd3..22acc15e236 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -36,6 +36,7 @@ SHELL = @SHELL@ cpu_type = @cpu_type@ enable_shared = @enable_shared@ +enable_libgcov = @enable_libgcov@ double_type_size = @double_type_size@ long_double_type_size = @long_double_type_size@ decimal_float = @decimal_float@ @@ -941,7 +942,10 @@ libgcc.a libgcov.a libunwind.a libgcc_eh.a: $(RANLIB) $@ -all: libgcc.a libgcov.a +all: libgcc.a +ifeq ($(enable_libgcov),yes) +all: libgcov.a +endif ifneq ($(LIBUNWIND),) all: libunwind.a @@ -1164,9 +1168,11 @@ install-leaf: $(install-shared) $(install-libunwind) $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a +ifeq ($(enable_libgcov),yes) $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/ chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a +endif parts="$(INSTALL_PARTS)"; \ for file in $$parts; do \ diff --git a/libgcc/configure.ac b/libgcc/configure.ac index b59aa746afc..a878c473f3d 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -68,6 +68,11 @@ AC_ARG_ENABLE(shared, ], [enable_shared=yes]) AC_SUBST(enable_shared) +AC_ARG_ENABLE(libgcov, +[ --disable-libgcov don't provide libgcov], +[], [enable_libgcov=yes]) +AC_SUBST(enable_libgcov) + AC_ARG_ENABLE(vtable-verify, [ --enable-vtable-verify Enable vtable verification feature ], [case "$enableval" in -- 2.15.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] libgcc: Add support for --disable-libgcov 2018-05-25 13:06 [PATCH] libgcc: Add support for --disable-libgcov Rasmus Villemoes @ 2018-05-25 16:40 ` Joseph Myers 2018-05-25 21:35 ` [PATCH v2] " Rasmus Villemoes 0 siblings, 1 reply; 8+ messages in thread From: Joseph Myers @ 2018-05-25 16:40 UTC (permalink / raw) To: Rasmus Villemoes; +Cc: gcc-patches A new configure option should be documented in install.texi. -- Joseph S. Myers joseph@codesourcery.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] libgcc: Add support for --disable-libgcov 2018-05-25 16:40 ` Joseph Myers @ 2018-05-25 21:35 ` Rasmus Villemoes 2018-06-01 12:11 ` Rasmus Villemoes 0 siblings, 1 reply; 8+ messages in thread From: Rasmus Villemoes @ 2018-05-25 21:35 UTC (permalink / raw) To: gcc-patches; +Cc: Joseph Myers, Rasmus Villemoes When trying to build gcc 6.4.0 targeting VxWorks 5.5, I ran into libgcov not building against the VxWorks system headers - there are multiple issues such as gcc-src/libgcc/../gcc/gcov-io.c:78:3: warning: implicit declaration of function 'getpid' [-Wimplicit-function-declaration] s_flock.l_pid = getpid (); ^ gcc-src/libgcc/libgcov.c:139:9: warning: implicit declaration of function 'access' [-Wimplicit-function-declaration] if (access (filename, F_OK) == -1 ^ gcc-src/libgcc/libgcov.c:139:31: error: 'F_OK' undeclared (first use in this function) if (access (filename, F_OK) == -1 ^ Moreover, from the gcov documentation, it would seem to be cumbersome at best to actually use it on VxWorks. So add an option for disabling build and install of libgcov. It would probably be most user-friendly if the resulting compiler would reject --coverage and -fprofile-arcs, but I couldn't find an easy way to do that. Also, the similar --disable-libsanitizer does not make the compiler complain about use of -fsanitize=xyz. 2018-05-25 Rasmus Villemoes <rasmus.villemoes@prevas.dk> gcc/doc/ * install.texi: Document --disable-libgcov. libgcc/ * Makefile.in: Honour @enable_libgcov@. * configure.ac: Add --disable-libgcov option. * configure: Regenerate. --- gcc/doc/install.texi | 4 ++++ libgcc/Makefile.in | 8 +++++++- libgcc/configure.ac | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 7c5cdc762d3..cf3496d37c6 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1673,6 +1673,10 @@ should not be built. Specify that the run-time libraries used by vtable verification should not be built. +@item --disable-libgcov +Specify that the run-time library used for coverage analysis +should not be built. + @item --with-dwarf2 Specify that the compiler should use DWARF 2 debugging information as the default. diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index dd8cee99fd3..22acc15e236 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -36,6 +36,7 @@ SHELL = @SHELL@ cpu_type = @cpu_type@ enable_shared = @enable_shared@ +enable_libgcov = @enable_libgcov@ double_type_size = @double_type_size@ long_double_type_size = @long_double_type_size@ decimal_float = @decimal_float@ @@ -941,7 +942,10 @@ libgcc.a libgcov.a libunwind.a libgcc_eh.a: $(RANLIB) $@ -all: libgcc.a libgcov.a +all: libgcc.a +ifeq ($(enable_libgcov),yes) +all: libgcov.a +endif ifneq ($(LIBUNWIND),) all: libunwind.a @@ -1164,9 +1168,11 @@ install-leaf: $(install-shared) $(install-libunwind) $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a +ifeq ($(enable_libgcov),yes) $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/ chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a +endif parts="$(INSTALL_PARTS)"; \ for file in $$parts; do \ diff --git a/libgcc/configure.ac b/libgcc/configure.ac index b59aa746afc..a878c473f3d 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -68,6 +68,11 @@ AC_ARG_ENABLE(shared, ], [enable_shared=yes]) AC_SUBST(enable_shared) +AC_ARG_ENABLE(libgcov, +[ --disable-libgcov don't provide libgcov], +[], [enable_libgcov=yes]) +AC_SUBST(enable_libgcov) + AC_ARG_ENABLE(vtable-verify, [ --enable-vtable-verify Enable vtable verification feature ], [case "$enableval" in -- 2.15.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] libgcc: Add support for --disable-libgcov 2018-05-25 21:35 ` [PATCH v2] " Rasmus Villemoes @ 2018-06-01 12:11 ` Rasmus Villemoes 2018-06-11 7:26 ` [PATCH v3] add support for --disable-gcov Rasmus Villemoes 0 siblings, 1 reply; 8+ messages in thread From: Rasmus Villemoes @ 2018-06-01 12:11 UTC (permalink / raw) To: gcc-patches; +Cc: Joseph Myers On 2018-05-25 23:34, Rasmus Villemoes wrote: [...] > add an option for disabling build and install of libgcov. > > > 2018-05-25 Rasmus Villemoes <rasmus.villemoes@prevas.dk> > > gcc/doc/ > * install.texi: Document --disable-libgcov. I see I messed up that Changelog fragment, is should have been "gcc/" and "* doc/install.texi". Anyway, thinking a bit more about this, it might be better to use --disable-gcov and have that also disable building the gcov tools. There's actually already comments like # Install gcov if it was compiled. and associated logic in gcc/Makefile, but I don't see how gcov could not be compiled: This is in the install-common target, which depends on native, which depends on $(LANGUAGES), which unconditionally contains gcov$(exeext) and friends. Thoughts? Rasmus ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3] add support for --disable-gcov 2018-06-01 12:11 ` Rasmus Villemoes @ 2018-06-11 7:26 ` Rasmus Villemoes 2018-06-12 21:18 ` Jeff Law 0 siblings, 1 reply; 8+ messages in thread From: Rasmus Villemoes @ 2018-06-11 7:26 UTC (permalink / raw) To: gcc-patches; +Cc: Joseph Myers, Rasmus Villemoes For some targets (in my case VxWorks 5.5), libgcov does not compile due to missing functions and macros such as getpid() and F_OK. Incidentally, gcc/Makefile.in already contains comments such as # Install gcov if it was compiled. but there is no logic in place to actually allow gcov to not be compiled. So add an option for disabling build and install of libgcov and the related host tools. 2018-06-10 Rasmus Villemoes <rasmus.villemoes@prevas.dk> gcc/ * configure.ac: Add --disable-gcov option. * configure: Regenerate. * Makefile.in: Honour @enable_gcov@. * doc/install.texi: Document --disable-gcov. libgcc/ * configure.ac: Add --disable-gcov option. * configure: Regenerate. * Makefile.in: Honour @enable_gcov@. --- gcc/Makefile.in | 6 ++++-- gcc/configure.ac | 5 +++++ gcc/doc/install.texi | 4 ++++ libgcc/Makefile.in | 8 +++++++- libgcc/configure.ac | 5 +++++ 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index d8f3e886118..1f38cacde7a 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -137,8 +137,10 @@ SUBDIRS =@subdirs@ build # Selection of languages to be made. CONFIG_LANGUAGES = @all_selected_languages@ -LANGUAGES = c gcov$(exeext) gcov-dump$(exeext) gcov-tool$(exeext) \ - $(CONFIG_LANGUAGES) +LANGUAGES = c $(CONFIG_LANGUAGES) +ifeq (@enable_gcov@,yes) +LANGUAGES += gcov$(exeext) gcov-dump$(exeext) gcov-tool$(exeext) +endif # Default values for variables overridden in Makefile fragments. # CFLAGS is for the user to override to, e.g., do a cross build with -O2. diff --git a/gcc/configure.ac b/gcc/configure.ac index 010ecd2ccf6..4fc851c644e 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -921,6 +921,11 @@ AC_ARG_ENABLE(shared, ], [enable_shared=yes]) AC_SUBST(enable_shared) +AC_ARG_ENABLE(gcov, +[ --disable-gcov don't provide libgcov and related host tools], +[], [enable_gcov=yes]) +AC_SUBST(enable_gcov) + AC_ARG_WITH(specs, [AS_HELP_STRING([--with-specs=SPECS], [add SPECS to driver command-line processing])], diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 7c5cdc762d3..03eaeed4e87 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -1044,6 +1044,10 @@ virtual calls in verifiable mode at all. However the libvtv library will still be built (see @option{--disable-libvtv} to turn off building libvtv). @option{--disable-vtable-verify} is the default. +@item --disable-gcov +Specify that the run-time library used for coverage analysis +and associated host tools should not be built. + @item --disable-multilib Specify that multiple target libraries to support different target variants, calling diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index dd8cee99fd3..b7f20557214 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -36,6 +36,7 @@ SHELL = @SHELL@ cpu_type = @cpu_type@ enable_shared = @enable_shared@ +enable_gcov = @enable_gcov@ double_type_size = @double_type_size@ long_double_type_size = @long_double_type_size@ decimal_float = @decimal_float@ @@ -941,7 +942,10 @@ libgcc.a libgcov.a libunwind.a libgcc_eh.a: $(RANLIB) $@ -all: libgcc.a libgcov.a +all: libgcc.a +ifeq ($(enable_gcov),yes) +all: libgcov.a +endif ifneq ($(LIBUNWIND),) all: libunwind.a @@ -1164,9 +1168,11 @@ install-leaf: $(install-shared) $(install-libunwind) $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a +ifeq ($(enable_libgcov),yes) $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/ chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a +endif parts="$(INSTALL_PARTS)"; \ for file in $$parts; do \ diff --git a/libgcc/configure.ac b/libgcc/configure.ac index b59aa746afc..9d0bbcaba86 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -68,6 +68,11 @@ AC_ARG_ENABLE(shared, ], [enable_shared=yes]) AC_SUBST(enable_shared) +AC_ARG_ENABLE(gcov, +[ --disable-gcov don't provide libgcov and related host tools], +[], [enable_gcov=yes]) +AC_SUBST(enable_gcov) + AC_ARG_ENABLE(vtable-verify, [ --enable-vtable-verify Enable vtable verification feature ], [case "$enableval" in -- 2.16.4 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] add support for --disable-gcov 2018-06-11 7:26 ` [PATCH v3] add support for --disable-gcov Rasmus Villemoes @ 2018-06-12 21:18 ` Jeff Law 2018-06-27 19:23 ` Rainer Orth 0 siblings, 1 reply; 8+ messages in thread From: Jeff Law @ 2018-06-12 21:18 UTC (permalink / raw) To: Rasmus Villemoes, gcc-patches; +Cc: Joseph Myers On 06/11/2018 01:25 AM, Rasmus Villemoes wrote: > For some targets (in my case VxWorks 5.5), libgcov does not compile due > to missing functions and macros such as getpid() and F_OK. > > Incidentally, gcc/Makefile.in already contains comments such as > > # Install gcov if it was compiled. > > but there is no logic in place to actually allow gcov to not be > compiled. I think in the past folks would do things like make LANGUAGES="c c++" Which would skip building gcov. > > So add an option for disabling build and install of libgcov and the > related host tools. > > 2018-06-10 Rasmus Villemoes <rasmus.villemoes@prevas.dk> > > gcc/ > * configure.ac: Add --disable-gcov option. > * configure: Regenerate. > * Makefile.in: Honour @enable_gcov@. > * doc/install.texi: Document --disable-gcov. > > libgcc/ > * configure.ac: Add --disable-gcov option. > * configure: Regenerate. > * Makefile.in: Honour @enable_gcov@. OK. Presumably you're going through the process to get write access. Once that's wrapped up you can install this patch. Thanks, jeff ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] add support for --disable-gcov 2018-06-12 21:18 ` Jeff Law @ 2018-06-27 19:23 ` Rainer Orth 2018-06-27 21:01 ` Rasmus Villemoes 0 siblings, 1 reply; 8+ messages in thread From: Rainer Orth @ 2018-06-27 19:23 UTC (permalink / raw) To: Jeff Law; +Cc: Rasmus Villemoes, gcc-patches, Joseph Myers [-- Attachment #1: Type: text/plain, Size: 1473 bytes --] Hi Jeff, >> So add an option for disabling build and install of libgcov and the >> related host tools. >> >> 2018-06-10 Rasmus Villemoes <rasmus.villemoes@prevas.dk> >> >> gcc/ >> * configure.ac: Add --disable-gcov option. >> * configure: Regenerate. >> * Makefile.in: Honour @enable_gcov@. >> * doc/install.texi: Document --disable-gcov. >> >> libgcc/ >> * configure.ac: Add --disable-gcov option. >> * configure: Regenerate. >> * Makefile.in: Honour @enable_gcov@. > OK. Presumably you're going through the process to get write access. > Once that's wrapped up you can install this patch. this patch badly broke all -fprofile-generate/-fprofile-use tests in the default case like this: UNRESOLVED: g++.dg/bprob/g++-bprob-1.C compilation, -O0 -fbranch-probabilities FAIL: g++.dg/bprob/g++-bprob-1.C compilation, -O0 -fprofile-arcs ld: fatal: library -lgcov: not found collect2: error: ld returned 1 exit status compiler exited with status 1 FAIL: g++.dg/bprob/g++-bprob-1.C compilation, -g -fprofile-arcs libgcov.a is not copied over from libgcc to gcc due to a typo in libgcc/Makefile.in. Fixed as follows; will install as obvious once bootstrap has finished. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2018-06-27 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * Makefile.in (install_leaf): Use enable_gcov instead of enable_libgcov. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: libgcc-enable_gcov.patch --] [-- Type: text/x-patch, Size: 613 bytes --] # HG changeset patch # Parent 5c87d0c29765b05d7da38622b0c67a4931fe47ce Fix typo in Makefile.in diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -1168,7 +1168,7 @@ install-leaf: $(install-shared) $(instal $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/ chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a -ifeq ($(enable_libgcov),yes) +ifeq ($(enable_gcov),yes) $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/ chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] add support for --disable-gcov 2018-06-27 19:23 ` Rainer Orth @ 2018-06-27 21:01 ` Rasmus Villemoes 0 siblings, 0 replies; 8+ messages in thread From: Rasmus Villemoes @ 2018-06-27 21:01 UTC (permalink / raw) To: Rainer Orth, Jeff Law; +Cc: gcc-patches, Joseph Myers On 2018-06-27 21:22, Rainer Orth wrote: > Hi Jeff, > >>> So add an option for disabling build and install of libgcov and the >>> related host tools. >>> >>> 2018-06-10 Rasmus Villemoes <rasmus.villemoes@prevas.dk> >>> >>> gcc/ >>> * configure.ac: Add --disable-gcov option. >>> * configure: Regenerate. >>> * Makefile.in: Honour @enable_gcov@. >>> * doc/install.texi: Document --disable-gcov. >>> >>> libgcc/ >>> * configure.ac: Add --disable-gcov option. >>> * configure: Regenerate. >>> * Makefile.in: Honour @enable_gcov@. >> OK. Presumably you're going through the process to get write access. >> Once that's wrapped up you can install this patch. > > this patch badly broke all -fprofile-generate/-fprofile-use tests in the > default case like this: > > UNRESOLVED: g++.dg/bprob/g++-bprob-1.C compilation, -O0 -fbranch-probabilities > FAIL: g++.dg/bprob/g++-bprob-1.C compilation, -O0 -fprofile-arcs > > ld: fatal: library -lgcov: not found > collect2: error: ld returned 1 exit status > compiler exited with status 1 > FAIL: g++.dg/bprob/g++-bprob-1.C compilation, -g -fprofile-arcs > > libgcov.a is not copied over from libgcc to gcc due to a typo in > libgcc/Makefile.in. Fixed as follows; will install as obvious once > bootstrap has finished. > I'm terribly sorry about that! I was sure I had tested all of --enable-gcov, --disable-gcov and none of those, and convinced myself that the default behaviour was unchanged. Thanks for spotting the problem and fixing it. I will try to be much more careful in the future. Rasmus ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-06-27 21:01 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-05-25 13:06 [PATCH] libgcc: Add support for --disable-libgcov Rasmus Villemoes 2018-05-25 16:40 ` Joseph Myers 2018-05-25 21:35 ` [PATCH v2] " Rasmus Villemoes 2018-06-01 12:11 ` Rasmus Villemoes 2018-06-11 7:26 ` [PATCH v3] add support for --disable-gcov Rasmus Villemoes 2018-06-12 21:18 ` Jeff Law 2018-06-27 19:23 ` Rainer Orth 2018-06-27 21:01 ` Rasmus Villemoes
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).