From nobody Mon Jun 21 15:25:29 2021 X-Original-To: arch@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 795D511D507E for ; Mon, 21 Jun 2021 15:25:50 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G7tdp2w7hz3q7S; Mon, 21 Jun 2021 15:25:50 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f175.google.com with SMTP id q12so4764737ilv.5; Mon, 21 Jun 2021 08:25:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=l5oGyY7QkOwr5C25VSHuc++Gex6xy3SrxgC/ykbYHfI=; b=Fa+m8YQUwvfMAygNQ5buYlZFYMjHkHetNx8F7ftrx+i22OJAQ/noFPqq2AO1cZ3pXS 2wYjCYSFA0tRek+Spt2KMs5Z/czd5mQapFlqtiXCzkYCgjX0s1N2hja9BbLbs7fBSVBf KI36CfMyBLi2B3tvPxaV8uos9xUanW1+jSD/DOXkbruOO3H/YOfyvtENnbHc9irNv/Qa iEP/9yTAuIootPdqWlgOqPfBrgeb9kN/UjYx5livZvZb+wdWI6LHX+9sYqmcRyKOUIF1 KJDJYMAwXjqEla4Qe10LvLCEgXoHj/k9DdQSCnUGr2I+NvWtUdqeBAIvYapfui9jpFR1 uvZg== X-Gm-Message-State: AOAM532Qy+m62RAchp08h/a22a0Co8QcSsLH+F1lneeOFJmUMoyD/iyb 1t7xIaBa1sOumGh19lperE3o39KorK9Tgby6gtyjunvVO9k= X-Google-Smtp-Source: ABdhPJzPn/odWLhNiT45nEbhxfiqAVfMdDbntmp+anavmvbqRGG01eTQ4U9yci4hZEDCReieTF3n2YDUgJVSSDJNc1c= X-Received: by 2002:a92:a002:: with SMTP id e2mr6813647ili.98.1624289149195; Mon, 21 Jun 2021 08:25:49 -0700 (PDT) List-Id: Discussion related to FreeBSD architecture List-Archive: https://lists.freebsd.org/archives/freebsd-arch List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arch@freebsd.org MIME-Version: 1.0 References: <202106180736.15I7aYmk068064@critter.freebsd.dk> <20210620210825.GA45154@troutmask.apl.washington.edu> In-Reply-To: <20210620210825.GA45154@troutmask.apl.washington.edu> From: Ed Maste Date: Mon, 21 Jun 2021 11:25:29 -0400 Message-ID: Subject: Re: It's time to kill statistical profiling To: Steve Kargl Cc: John Baldwin , Poul-Henning Kamp , "freebsd-arch@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4G7tdp2w7hz3q7S X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Sun, 20 Jun 2021 at 17:08, Steve Kargl 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 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.