This patch changes the build machinery in order to disable the build
of GCOV (both compiler and libgcc) in bpf-*-* targets.  The reason for
this change is that BPF is (currently) too restricted in order to
support the coverage instrumentalization.

Tested in bpf-unknown-none and x86_64-linux-gnu targets.

2022-02-23  Jose E. Marchesi  <jose.march...@oracle.com>

gcc/ChangeLog

        PR target/104656
        * configure.ac: --disable-gcov if targetting bpf-*.
        * configure: Regenerate.

libgcc/ChangeLog

        PR target/104656
        * configure.ac: --disable-gcov if targetting bpf-*.
        * configure: Regenerate.
---
 gcc/configure       | 14 +++++++++++---
 gcc/configure.ac    | 10 +++++++++-
 libgcc/configure    | 31 +++++++++++++++++++------------
 libgcc/configure.ac | 17 ++++++++++++-----
 4 files changed, 51 insertions(+), 21 deletions(-)

diff --git a/gcc/configure b/gcc/configure
index 258b17a226e..22eb3451e3d 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -8085,12 +8085,20 @@ fi
 if test "${enable_gcov+set}" = set; then :
   enableval=$enable_gcov;
 else
-  enable_gcov=yes
+  case $target in
+       bpf-*-*)
+         enable_gcov=no
+       ;;
+       *)
+         enable_gcov=yes
+       ;;
+     esac
 fi
 
 
 
 
+
 # Check whether --with-specs was given.
 if test "${with_specs+set}" = set; then :
   withval=$with_specs; CONFIGURE_SPECS=$withval
@@ -19659,7 +19667,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19662 "configure"
+#line 19670 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -19765,7 +19773,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 19768 "configure"
+#line 19776 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 06750cee977..20da90901f8 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1041,7 +1041,15 @@ AC_SUBST(enable_shared)
 
 AC_ARG_ENABLE(gcov,
 [  --disable-gcov          don't provide libgcov and related host tools],
-[], [enable_gcov=yes])
+[], [case $target in
+       bpf-*-*)
+         enable_gcov=no
+       ;;
+       *)
+         enable_gcov=yes
+       ;;
+     esac])
+
 AC_SUBST(enable_gcov)
 
 AC_ARG_WITH(specs,
diff --git a/libgcc/configure b/libgcc/configure
index 4919a56f518..52bf25d4e94 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -630,6 +630,7 @@ LIPO
 AR
 toolexeclibdir
 toolexecdir
+enable_gcov
 target_subdir
 host_subdir
 build_subdir
@@ -653,7 +654,6 @@ build_cpu
 build
 with_aix_soname
 enable_vtable_verify
-enable_gcov
 enable_shared
 libgcc_topdir
 target_alias
@@ -701,7 +701,6 @@ with_target_subdir
 with_cross_host
 with_ld
 enable_shared
-enable_gcov
 enable_vtable_verify
 with_aix_soname
 enable_version_specific_runtime_libs
@@ -709,6 +708,7 @@ with_toolexeclibdir
 with_slibdir
 enable_maintainer_mode
 with_build_libsubdir
+enable_gcov
 enable_largefile
 enable_decimal_float
 with_system_libunwind
@@ -1342,12 +1342,12 @@ Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-shared        don't provide a shared libgcc
-  --disable-gcov          don't provide libgcov and related host tools
   --enable-vtable-verify    Enable vtable verification feature
   --enable-version-specific-runtime-libs    Specify that runtime libraries 
should be installed in a compiler-specific directory
   --enable-maintainer-mode
                           enable make rules and dependencies not useful (and
                           sometimes confusing) to the casual installer
+  --disable-gcov          don't provide libgcov and related host tools
   --disable-largefile     omit support for large files
   --enable-decimal-float={no,yes,bid,dpd}
                        enable decimal float extension to C.  Selecting 'bid'
@@ -2252,15 +2252,6 @@ fi
 
 
 
-# Check whether --enable-gcov was given.
-if test "${enable_gcov+set}" = set; then :
-  enableval=$enable_gcov;
-else
-  enable_gcov=yes
-fi
-
-
-
 # Check whether --enable-vtable-verify was given.
 if test "${enable_vtable_verify+set}" = set; then :
   enableval=$enable_vtable_verify; case "$enableval" in
@@ -2713,6 +2704,22 @@ fi
 target_subdir=${target_noncanonical}
 
 
+# Check whether --enable-gcov was given.
+if test "${enable_gcov+set}" = set; then :
+  enableval=$enable_gcov;
+else
+  case $target in
+       bpf-*-*)
+         enable_gcov=no
+       ;;
+       *)
+         enable_gcov=yes
+       ;;
+     esac
+fi
+
+
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 13a80b2551b..6f0b67c2adc 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -68,11 +68,6 @@ 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
@@ -163,6 +158,18 @@ ACX_NONCANONICAL_HOST
 ACX_NONCANONICAL_TARGET
 GCC_TOPLEV_SUBDIRS
 
+AC_ARG_ENABLE(gcov,
+[  --disable-gcov          don't provide libgcov and related host tools],
+[], [case $target in
+       bpf-*-*)
+         enable_gcov=no
+       ;;
+       *)
+         enable_gcov=yes
+       ;;
+     esac])
+AC_SUBST(enable_gcov)
+
 # Calculate toolexeclibdir
 # Also toolexecdir, though it's only used in toolexeclibdir
 case ${version_specific_libs} in
-- 
2.11.0

Reply via email to