Bug 216021 - lang/gcc* all symbols for libgcov.a should likely be exposed
Summary: lang/gcc* all symbols for libgcov.a should likely be exposed
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Andreas Tobler
Depends on:
Reported: 2017-01-13 10:39 UTC by Enji Cooper
Modified: 2017-01-14 15:23 UTC (History)
5 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer 2017-01-13 10:39:16 UTC
For reasons similar to what I explained in https://reviews.freebsd.org/D9168 (which includes a repro), more of the gcov symbols should be exposed in order for --coverage to "just work" with gcc like suggested in the toolchain manpage. Otherwise I have to explicitly use -lgcov when linking binaries, which is broken per the docs... From man 1 gcc:

           This option is used to compile and link code instrumented for
           coverage analysis.  The option is a synonym for -fprofile-arcs
           -ftest-coverage (when compiling) and -lgcov (when linking).  See
           the documentation for those options for more details.

/usr/local/bin/ld: foo.full: hidden symbol `__gcov_merge_add' in /usr/local/lib/gcc49/gcc/x86_64-portbld-freebsd12.0/4.9.4/libgcov.a(_gcov_merge_add.o) is referenced by DSO
/usr/local/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
*** Error code 1
Comment 1 Gerald Pfeifer freebsd_committer 2017-01-13 18:16:37 UTC
Andreas, is this something you can help with (upstream first, probably,
and then we'll see)?
Comment 2 Enji Cooper freebsd_committer 2017-01-13 23:54:54 UTC
(In reply to Gerald Pfeifer from comment #1)

Thank you for driving this. I'd really like to add --coverage support and lcov coverage gathering to FreeBSD for $work.
Comment 3 Andreas Tobler freebsd_committer 2017-01-14 15:23:33 UTC
Can you help me bit?

I get this:

[m91p:~] andreast% gcc49 -o hashtest --coverage hashtest.c
[m91p:~] andreast% nm hashtest | grep gcov_merge
0000000000402080 T __gcov_merge_add

No errors.