Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 May 2019 04:24:28 +0000 (UTC)
From:      Enji Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r347607 - projects/runtime-coverage-v2/share/mk
Message-ID:  <201905150424.x4F4OS4L025044@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Wed May 15 04:24:28 2019
New Revision: 347607
URL: https://svnweb.freebsd.org/changeset/base/347607

Log:
  Verify that the linker supports the DWARF v4 spec
  
  This change goes one step further in testing for coverage support by ensuring
  that the linker is LLD and supports DWARF v4.
  
  This is a proper fix for the arm/armv6 case not supporting `--coverage` with
  bfd.
  
  As a side effect, this change intentionally blacklists `--coverage` support
  with binutils, i.e., the raw gcc toolchain. I will need to figure out what
  versions of binutils support DWARF v4, etc, then add support for them after
  verifying that they function with `--coverage`, most likely using an
  xtoolchain.

Modified:
  projects/runtime-coverage-v2/share/mk/bsd.lib.mk
  projects/runtime-coverage-v2/share/mk/bsd.linker.mk
  projects/runtime-coverage-v2/share/mk/bsd.prog.mk
  projects/runtime-coverage-v2/share/mk/src.opts.mk

Modified: projects/runtime-coverage-v2/share/mk/bsd.lib.mk
==============================================================================
--- projects/runtime-coverage-v2/share/mk/bsd.lib.mk	Wed May 15 03:39:27 2019	(r347606)
+++ projects/runtime-coverage-v2/share/mk/bsd.lib.mk	Wed May 15 04:24:28 2019	(r347607)
@@ -5,9 +5,10 @@
 .include <bsd.init.mk>
 .include <bsd.compiler.mk>
 
-# This forces coverage off if the compiler isn't capable, as src.opts.mk is too
-# late sometimes.
-.if !${COMPILER_FEATURES:Mcoverage}
+# This forces coverage off if the compiler/linker isn't capable, as src.opts.mk
+# is not always used in time.
+.if !${COMPILER_FEATURES:Mcoverage} && \
+    (${LINKER_TYPE} == "lld" && !${LINKER_FEATURES:Mdwarfv4})
 MK_COVERAGE:=	no
 .endif
 

Modified: projects/runtime-coverage-v2/share/mk/bsd.linker.mk
==============================================================================
--- projects/runtime-coverage-v2/share/mk/bsd.linker.mk	Wed May 15 03:39:27 2019	(r347606)
+++ projects/runtime-coverage-v2/share/mk/bsd.linker.mk	Wed May 15 04:24:28 2019	(r347607)
@@ -13,6 +13,7 @@
 # linker support for that feature:
 #
 # - build-id:  support for generating a Build-ID note
+# - dwarfv4:   support for DWARF v4 format
 # - retpoline: support for generating PLT with retpoline speculative
 #              execution vulnerability mitigation
 #
@@ -87,6 +88,7 @@ ${X_}LINKER_FEATURES+=	build-id
 ${X_}LINKER_FEATURES+=	ifunc
 .endif
 .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 60000
+${X_}LINKER_FEATURES+=	dwarfv4
 ${X_}LINKER_FEATURES+=	retpoline
 .endif
 .endif

Modified: projects/runtime-coverage-v2/share/mk/bsd.prog.mk
==============================================================================
--- projects/runtime-coverage-v2/share/mk/bsd.prog.mk	Wed May 15 03:39:27 2019	(r347606)
+++ projects/runtime-coverage-v2/share/mk/bsd.prog.mk	Wed May 15 04:24:28 2019	(r347607)
@@ -4,9 +4,10 @@
 .include <bsd.init.mk>
 .include <bsd.compiler.mk>
 
-# This forces coverage off if the compiler isn't capable, as src.opts.mk is too
-# late sometimes.
-.if !${COMPILER_FEATURES:Mcoverage}
+# This forces coverage off if the compiler/linker isn't capable, as src.opts.mk
+# is not always used in time.
+.if !${COMPILER_FEATURES:Mcoverage} && \
+    (${LINKER_TYPE} == "lld" && !${LINKER_FEATURES:Mdwarfv4})
 MK_COVERAGE:=	no
 .endif
 

Modified: projects/runtime-coverage-v2/share/mk/src.opts.mk
==============================================================================
--- projects/runtime-coverage-v2/share/mk/src.opts.mk	Wed May 15 03:39:27 2019	(r347606)
+++ projects/runtime-coverage-v2/share/mk/src.opts.mk	Wed May 15 04:24:28 2019	(r347607)
@@ -318,13 +318,6 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_C
 .if ${__T} == "aarch64" || ${__T:Mriscv*} != ""
 BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB
 .endif
-# --coverage support does not work on arm/armv6 because LLD/LLVM is disabled on
-# these platforms by default, and the binutils in base lacks DWARF v4 support.
-#
-# Force support off.
-.if ${__T} == "arm" || ${__T} == "armv6"
-BROKEN_OPTIONS+=COVERAGE COVERAGE_SUPPORT
-.endif
 .if ${__T:Mriscv*} != ""
 BROKEN_OPTIONS+=OFED
 .endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905150424.x4F4OS4L025044>