Re: It's time to kill statistical profiling
- Reply: Steve Kargl : "Re: It's time to kill statistical profiling"
- In reply to: Steve Kargl : "Re: It's time to kill statistical profiling"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Jun 2021 15:25:29 UTC
On Sun, 20 Jun 2021 at 17:08, Steve Kargl
<sgk@troutmask.apl.washington.edu> wrote:
>
> Are there plans to replace the _p.a with something
> that allows profiling code? If not, are you upstreaming
> patches to GCC to disable -pg? AFAIK, 'gcc10 -pg ... -lm'
> causes gcc to look for at least libc_p.a and libm_p.a.
I believe this is how GCC operates indeed, but I'm not aware of the
implementation or specific details. Clang behaves as you describe --
here is all behaviour change based on OPT_pg, from
lib/Driver/ToolChains/FreeBSD.cpp:
if (!Args.hasArg(options::OPT_shared)) {
if (Args.hasArg(options::OPT_pg))
crt1 = "gcrt1.o";
else if (IsPIE)
crt1 = "Scrt1.o";
else
crt1 = "crt1.o";
}
...
if (Args.hasArg(options::OPT_pg))
CmdArgs.push_back("-lm_p");
else
CmdArgs.push_back("-lm");
and similar for -lgcc_p, -lgcc_eh_p, -lpthread_p, -lc_p, -lc++_p, -lstdc++_p.
This support was initially introduced upstream in:
commit 66f2276aee67738d116d26494d8a78fc6528586b
Author: Roman Divacky <rdivacky@freebsd.org>
Date: Thu Feb 10 16:59:40 2011 +0000
Adjust the object files to be linked in when mcount profiling
is specified in the FreeBSD linker driver.
llvm-svn: 125285
and was implemented for OpenBSD later that year, but no other OS does
this. I'm not sure exactly what happens elsewhere - my guess is that
the runtime support exists in libc but it is built without -pg so
coverage will not include libc itself.