Nick Lewycky | 10 May 01:20 2011
Picon

linking coverage library

Recently I added support for gcov-compatible coverage analysis to compilation. The remaining missing piece is that we should link against libprofile_rt.a when we see the relevant flags in the link step.


There's currently code in the Driver which adds "-lgcov" when those flags are visible in the link step. Will it break anything for anyone if I remove that? Consider the case where someone uses clang to build fortran by running gfortran and it emits a calls to libgcov that is then linked by clang?

Then I'd like to add in "-l:libprofile_rt.a". I know how gcc puts libgcov, but how do we ship libraries alongside clang? Does clang pass library search path flags to the linker?

If we can't remove -lgcov because of some reason, can we pass both -lgcov and "-l:profile_rt.a"? What about people without gcc installed?

Nick

_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Sean McBride | 10 May 16:54 2011

Re: linking coverage library

On Mon, 9 May 2011 16:20:47 -0700, Nick Lewycky said:

>Recently I added support for gcov-compatible coverage analysis to
>compilation.

Awesome!  You might want to update this bug:

<http://llvm.org/bugs/show_bug.cgi?id=8030>

--

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean@...
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada
Eric Christopher | 17 May 09:45 2011
Picon

Re: linking coverage library


On May 9, 2011, at 4:20 PM, Nick Lewycky wrote:

> Recently I added support for gcov-compatible coverage analysis to compilation. The remaining missing
piece is that we should link against libprofile_rt.a when we see the relevant flags in the link step.
> 
> There's currently code in the Driver which adds "-lgcov" when those flags are visible in the link step.
Will it break anything for anyone if I remove that? Consider the case where someone uses clang to build
fortran by running gfortran and it emits a calls to libgcov that is then linked by clang?
> 
> Then I'd like to add in "-l:libprofile_rt.a". I know how gcc puts libgcov, but how do we ship libraries
alongside clang? Does clang pass library search path flags to the linker?
> 
> If we can't remove -lgcov because of some reason, can we pass both -lgcov and "-l:profile_rt.a"? What
about people without gcc installed?

I can't see why we can't remove the gcov one. At any rate the symbols generated, afaict, are going to have
llvm_ prefixed on them and so we'd need the libprofile_rt ones anyhow.

-eric
Nick Lewycky | 24 May 05:21 2011
Picon

Re: linking coverage library

On 17 May 2011 00:45, Eric Christopher <echristo-2kanFRK1NckAvxtiuMwx3w@public.gmane.org> wrote:

On May 9, 2011, at 4:20 PM, Nick Lewycky wrote:

> Recently I added support for gcov-compatible coverage analysis to compilation. The remaining missing piece is that we should link against libprofile_rt.a when we see the relevant flags in the link step.
>
> There's currently code in the Driver which adds "-lgcov" when those flags are visible in the link step. Will it break anything for anyone if I remove that? Consider the case where someone uses clang to build fortran by running gfortran and it emits a calls to libgcov that is then linked by clang?
>
> Then I'd like to add in "-l:libprofile_rt.a". I know how gcc puts libgcov, but how do we ship libraries alongside clang? Does clang pass library search path flags to the linker?
>
> If we can't remove -lgcov because of some reason, can we pass both -lgcov and "-l:profile_rt.a"? What about people without gcc installed?

I can't see why we can't remove the gcov one. At any rate the symbols generated, afaict, are going to have llvm_ prefixed on them and so we'd need the libprofile_rt ones anyhow.

Sounds good. I've gone ahead and implemented this in the attached patch. Good to commit?

Nick

Attachment (clang-libprofile_rt.patch): text/x-patch, 5410 bytes
_______________________________________________
cfe-dev mailing list
cfe-dev@...
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Eric Christopher | 24 May 08:51 2011
Picon

Re: linking coverage library


On May 23, 2011, at 8:21 PM, Nick Lewycky wrote:

> Sounds good. I've gone ahead and implemented this in the attached patch. Good to commit?
> 
> Nick
> 
> <clang-libprofile_rt.patch>

LGTM.

-eric

Gmane