Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EEBFC433EF for ; Sat, 13 Nov 2021 13:40:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6727061051 for ; Sat, 13 Nov 2021 13:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235226AbhKMNnT (ORCPT ); Sat, 13 Nov 2021 08:43:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:51662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230021AbhKMNnS (ORCPT ); Sat, 13 Nov 2021 08:43:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F294361073; Sat, 13 Nov 2021 13:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636810826; bh=jQzRLt4dErQKFo4RaHfJ9zEivHlqGx2hhtKxApIRPNk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mQ7kEGbvm4+5vvhbK58uedwsYXlnBH68hRaa+YML0TdevwsnhjtVoAsM0cxHrU0F6 iFwzkLWMziBPJuA1pBFwK078ElNCmiB03j134se+C7I8eId8I5X+PCdqcbM8aIF+wD qWNjqlpNQ0T9PD+3tU0YaSAbv/0za8xdnYNEwGuTii9VPTqTw80FtqAWVKcdPLer6k mkU/MC9JjQG5+HrC1Udq78i4sKbuF92H1urU1TSTiB39P1xEBLIAO4Osa/QzSOIOqm H+YV+MT+hO8ngvD33bPi9HcVctCTKJNXkeSSuhz7J8oNfn8zKUqCHwVjtbzHmevyF1 RhuFPR8kIY8xA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 77563410A1; Sat, 13 Nov 2021 10:40:23 -0300 (-03) Date: Sat, 13 Nov 2021 10:40:23 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Jiri Olsa , lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , linux-perf-users@vger.kernel.org, Andrii Nakryiko Subject: Re: [PATCH 1/2] perf tools: Add more weak libbpf functions Message-ID: References: <20211109140707.1689940-1-jolsa@kernel.org> <20211109140707.1689940-2-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Nov 09, 2021 at 10:49:53AM -0800, Ian Rogers escreveu: > On Tue, Nov 9, 2021 at 6:07 AM Jiri Olsa wrote: > > > > We hit the window where perf uses libbpf functions, that did not > > make it to the official libbpf release yet and it's breaking perf > > build with dynamicly linked libbpf. > > > > Fixing this by providing the new interface as weak functions which > > calls the original libbpf functions. Fortunatelly the changes were > > just renames. > > Could we just provide these functions behind a libbpf version #if ? > Weak symbols break things in subtle ways, under certain circumstances > the weak symbol is preferred over the strong due to lazy object file > resolution: > https://maskray.me/blog/2021-06-20-symbol-processing#archive-processing > This bit me last week, but in general you get away with it as the lazy > object file will get processed in an archive exposing the strong > symbol. With an #if you either get a linker error for 2 definitions or > 0 definitions, and it's clear what is broken. > > In the past we had problems due to constant propagation from weak > const variables, where #if was the solution: > https://lore.kernel.org/lkml/20191001003623.255186-1-irogers@google.com/ > > There was some recent conversation on libbpf version for pahole here: > https://lore.kernel.org/bpf/CAP-5=fUc3LtU0WYg-Py9Jf+9picaWHJdSw=sdOMA54uY3p1pdw@mail.gmail.com/T/ > https://lore.kernel.org/bpf/20211021183330.460681-1-irogers@google.com/ Valid concerns and we should improve the situation, but I'm going with Jiri's stopgap solution so as to have everything buildind for v5.16, which window is closing. We can improve this in followup patches. Thanks, - Arnaldo