Date: Mon, 21 Jun 2021 11:25:29 -0400 From: Ed Maste <emaste@freebsd.org> To: Steve Kargl <sgk@troutmask.apl.washington.edu> Cc: John Baldwin <jhb@freebsd.org>, Poul-Henning Kamp <phk@phk.freebsd.dk>, "freebsd-arch@freebsd.org" <arch@freebsd.org> Subject: Re: It's time to kill statistical profiling Message-ID: <CAPyFy2AqFgya66PiyjFB2Xkbck3rMqVNEtTgEYDnNhw7P8EXpQ@mail.gmail.com> In-Reply-To: <20210620210825.GA45154@troutmask.apl.washington.edu> References: <202106180736.15I7aYmk068064@critter.freebsd.dk> <d63d21fe-c1ef-dbb9-64e2-3e23621820bc@FreeBSD.org> <CAPyFy2BV0R_uXir1dYf8nN2JEOCZCprKYbHa6E1biFFJMbmAQQ@mail.gmail.com> <20210620210825.GA45154@troutmask.apl.washington.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAPyFy2AqFgya66PiyjFB2Xkbck3rMqVNEtTgEYDnNhw7P8EXpQ>