Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1195766pxb; Fri, 27 Aug 2021 03:37:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4NZA9lmyk7IHC+OcXBmlDnLWXfArMaedGtULralYsNjvTmtxKqMNjZkHttJy2vlKEp/+M X-Received: by 2002:a17:906:32d6:: with SMTP id k22mr9178417ejk.228.1630060636604; Fri, 27 Aug 2021 03:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630060636; cv=none; d=google.com; s=arc-20160816; b=iPgq5r7iy8T6gV+6ha0VXzd972xxCDvN+2CLbhOpsMwmNUUEROQDQXh8lMv4Fbv0q0 0IqxothKc4z1t9/g/z3O/4llqzkJBPJtsTxgeEDNP97vaud/YtCxC+X1tsKFgLHBcxAl oY95mLwKaMjBajQww/Vm1UeEyhUsTKPO+HdTUl4aj682Su9uVzbzJDJRs9jVgHYAw5rF MU1ix6ZxULgPuazLHpjkqszJoD1EX2WFd+ro3Co6Ra6xchjk6GcrpLJsVlg3a9GaX5M0 8UEMk5Y/QxA2rR/hoHhQdTOsvDb80KY3eZ1xK/txRsuF5zOGXvI0zxg74lU2iDzLrpp3 57lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=niAdtdRCe3YpJfeiYeUkcQkA9WVjzr/Y1St+dfHJ19g=; b=Gr9Q2Eca8xu751f0GRfrPDU6QGUTnOMnEYBM9ba1kxqTyRPtFFThlYN3KQlwTiVqOS IOw4KkBkVZ3UtR6NwfuxUpyS5gjfD1Y8/y58A/HHLoxbPQqmBp8XBR7T576CrfL0XpYv RyYMeJnIkTNDZbRB0Lnw6wOVgJ6OZmsesrSD/QfeV3OhHBRQSceIr+FYeBwFktSPvUPM hIhkruoug6hxTOuZe31AiEQv9exhRDRtxqrKRkZvIbX+6YxwUOsRubBREeD0pPeh3Cvx +pTCgQ9BRqZBb0JYCZTZ4le49TunBagwUfogikoX3Ya2h1a+dCKJAie7qa42hAoCY7VD W4tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=bGRUA8sC; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si5978183edr.277.2021.08.27.03.36.54; Fri, 27 Aug 2021 03:37:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=bGRUA8sC; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244873AbhH0KgZ (ORCPT + 99 others); Fri, 27 Aug 2021 06:36:25 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:48172 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233315AbhH0KgY (ORCPT ); Fri, 27 Aug 2021 06:36:24 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 98878223A7; Fri, 27 Aug 2021 10:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1630060534; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=niAdtdRCe3YpJfeiYeUkcQkA9WVjzr/Y1St+dfHJ19g=; b=bGRUA8sCloiajoYtwpYGvw/NjZTUgRDhltqgbcujdXto30eUX+gl0W/qvwhHN8IG/C45jU jpKN1JCRoWw7cbLBBVmI/ronTH6QfJGJUWgi2yccDn1SvFt43IhhmvRB2DbaQFurgqq5z+ xGlYXNYaJHOFnIhoWniEunm2AsUvUGg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1630060534; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=niAdtdRCe3YpJfeiYeUkcQkA9WVjzr/Y1St+dfHJ19g=; b=j5RRjcIxfPmjkIqfqgKufe7b3Get8FCHVvITIft9iOIVkpWBk6xn5amNXep2SXguQ4yrlT KtNCmoplL7d1wZBQ== Received: from kunlun.suse.cz (unknown [10.100.128.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 69FD7A3B94; Fri, 27 Aug 2021 10:35:34 +0000 (UTC) Date: Fri, 27 Aug 2021 12:35:33 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: bpf@vger.kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Magnus Karlsson , Jonathan Lemon , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Patrick McCarty Subject: Re: [PATCH] libbpf: Fix build with latest gcc/binutils with LTO Message-ID: <20210827103533.GF21630@kunlun.suse.cz> References: <20210827072855.3664-1-msuchanek@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210827072855.3664-1-msuchanek@suse.de> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, this is a duplicate of https://patchwork.kernel.org/project/netdevbpf/patch/20210827072539.3399-1-msuchanek@suse.de/ Sorry aboit the noise. On Fri, Aug 27, 2021 at 09:28:55AM +0200, Michal Suchanek wrote: > From: Patrick McCarty > > After updating to binutils 2.35, the build began to fail with an > assembler error. A bug was opened on the Red Hat Bugzilla a few days > later for the same issue. > > Work around the problem by using the new `symver` attribute (introduced > in GCC 10) as needed, instead of the `COMPAT_VERSION` and > `DEFAULT_VERSION` macros, which expand to assembler directives. > > Fixes: https://github.com/libbpf/libbpf/issues/338 > Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1863059 > Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1188749 > Signed-off-by: Patrick McCarty > Make the change conditional on GCC version > Signed-off-by: Michal Suchanek > --- > tools/lib/bpf/libbpf_internal.h | 23 +++++++++++++++++------ > tools/lib/bpf/xsk.c | 4 ++-- > 2 files changed, 19 insertions(+), 8 deletions(-) > > diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h > index 016ca7cb4f8a..af0f3fb102c0 100644 > --- a/tools/lib/bpf/libbpf_internal.h > +++ b/tools/lib/bpf/libbpf_internal.h > @@ -86,20 +86,31 @@ > (offsetof(TYPE, FIELD) + sizeof(((TYPE *)0)->FIELD)) > #endif > > +#ifdef __GNUC__ > +# if __GNUC__ >= 10 > +# define DEFAULT_VERSION(internal_name, api_name, version) \ > +__attribute__((__symver__(#api_name "@@" #version))) > +# define COMPAT_VERSION(internal_name, api_name, version) \ > +__attribute__((__symver__(#api_name "@" #version))) > +# endif > +#endif > + > +#if !defined(COMPAT_VERSION) || !defined(DEFAULT_VERSION) > /* Symbol versioning is different between static and shared library. > * Properly versioned symbols are needed for shared library, but > * only the symbol of the new version is needed for static library. > */ > -#ifdef SHARED > -# define COMPAT_VERSION(internal_name, api_name, version) \ > +# ifdef SHARED > +# define COMPAT_VERSION(internal_name, api_name, version) \ > asm(".symver " #internal_name "," #api_name "@" #version); > -# define DEFAULT_VERSION(internal_name, api_name, version) \ > +# define DEFAULT_VERSION(internal_name, api_name, version) \ > asm(".symver " #internal_name "," #api_name "@@" #version); > -#else > -# define COMPAT_VERSION(internal_name, api_name, version) > -# define DEFAULT_VERSION(internal_name, api_name, version) \ > +# else > +# define COMPAT_VERSION(internal_name, api_name, version) > +# define DEFAULT_VERSION(internal_name, api_name, version) \ > extern typeof(internal_name) api_name \ > __attribute__((alias(#internal_name))); > +# endif > #endif > > extern void libbpf_print(enum libbpf_print_level level, > diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c > index e9b619aa0cdf..a2111696ba91 100644 > --- a/tools/lib/bpf/xsk.c > +++ b/tools/lib/bpf/xsk.c > @@ -281,6 +281,7 @@ static int xsk_create_umem_rings(struct xsk_umem *umem, int fd, > return err; > } > > +DEFAULT_VERSION(xsk_umem__create_v0_0_4, xsk_umem__create, LIBBPF_0.0.4) > int xsk_umem__create_v0_0_4(struct xsk_umem **umem_ptr, void *umem_area, > __u64 size, struct xsk_ring_prod *fill, > struct xsk_ring_cons *comp, > @@ -345,6 +346,7 @@ struct xsk_umem_config_v1 { > __u32 frame_headroom; > }; > > +COMPAT_VERSION(xsk_umem__create_v0_0_2, xsk_umem__create, LIBBPF_0.0.2) > int xsk_umem__create_v0_0_2(struct xsk_umem **umem_ptr, void *umem_area, > __u64 size, struct xsk_ring_prod *fill, > struct xsk_ring_cons *comp, > @@ -358,8 +360,6 @@ int xsk_umem__create_v0_0_2(struct xsk_umem **umem_ptr, void *umem_area, > return xsk_umem__create_v0_0_4(umem_ptr, umem_area, size, fill, comp, > &config); > } > -COMPAT_VERSION(xsk_umem__create_v0_0_2, xsk_umem__create, LIBBPF_0.0.2) > -DEFAULT_VERSION(xsk_umem__create_v0_0_4, xsk_umem__create, LIBBPF_0.0.4) > > static enum xsk_prog get_xsk_prog(void) > { > -- > 2.31.1 >