Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1067890ybl; Fri, 13 Dec 2019 09:03:36 -0800 (PST) X-Google-Smtp-Source: APXvYqx2iGVIDguORiIMSJ3+dM1sLvFZrqotRSgud0hRY+4lx9AftwBfyTmDgomT+HWjKH7g093K X-Received: by 2002:a05:6830:1501:: with SMTP id k1mr16166168otp.209.1576256616550; Fri, 13 Dec 2019 09:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576256616; cv=none; d=google.com; s=arc-20160816; b=AB/fIpoxt5tkFAnCj4XGZWkeUNB+cLIddEDd0xEArJ9rl1CVXxC+edyS7NfJTLAQgd YxcP6z2h0oJ3Qlk5mVioTSRoNufvvTTjQLMrW6vR6syzRHnh7GoVbU5Z/768a+f+E/SU D+DPoPjAXvG5SGiLrEPqDAiKGchdFYtsKtqVIInBthoLJWnansmxtYG5qoAlwih8KaLO MlemBtItCdQ3PwszSIpVLRB2w3+Jo8y3dLclzct4GeCJBMd/ODqt4IGYd33hqT13rRTG ItWjIs4vbT2f/dkeVbZqCleYpV44mMYCgVcz1Iyx91i15Fc2cwTsarnwePCjyYpriaZQ k/xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vUE8AEfpv1Je3ytswJ2t5UjmrKOaLm5nTOW/OGZXKqs=; b=Oet1nQPOj9Op4nkZUbxETK+T5VcIC2sCZF8aJxdJLbgbSGdgiFyubuYku3MnNmBLsW j6+5OEzGHdIZ922DOS9uh+9ZEsJBIk+Xrkv2HcM5FV3DWt2yfhaUxpNEv/vHkMsV5GTz Dq0oqCIOIj1BPsWi4g0xQ+Go19SlP4W6YCnQWtWvyjD/LuzV3p/mMEDMuJwvBiz5k/a7 jUmbz89gTMP7U9RW6OBw3HuqhcdQOY1ebz9iFOncJJOTnXGMjMVtCrzN07anGLyl4T18 LjrM/Mb5/aEnnHB8GqAkMO5LUOS7bCMMjM2/SukavS39BmWJqeQ1LQJp8/A1hXBJB/UA OlOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LiRgSKsE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v4si5124846oth.3.2019.12.13.09.03.23; Fri, 13 Dec 2019 09:03:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LiRgSKsE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728398AbfLMRCc (ORCPT + 99 others); Fri, 13 Dec 2019 12:02:32 -0500 Received: from mail-qv1-f67.google.com ([209.85.219.67]:43673 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728109AbfLMRCb (ORCPT ); Fri, 13 Dec 2019 12:02:31 -0500 Received: by mail-qv1-f67.google.com with SMTP id p2so15803qvo.10; Fri, 13 Dec 2019 09:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vUE8AEfpv1Je3ytswJ2t5UjmrKOaLm5nTOW/OGZXKqs=; b=LiRgSKsEotztqVrsicsLsNUDrDyYeIVpc5+lRgzqczvL62rsuBj4Sa8kv7CHVoxoXH EWf2/4n/6YSz0KEDVyfYtJTpb8F7EmGyVJR+ZshuzOr+rwiewODBxJsSOOlq9GFzmfmR xbyfqPPoFwYCGFYTbxa0kspoKBUFBP8SWqe6HFH220EKZNVz5tnRGO45bF6o7uPDCsYs c/oZxItM/SELe7rS2ok8whcpRv0BeIPcwpH6Sy1KO9LukZKVfqv3oXFTjiNf3iXIc7hr s0ZkR9IY00n1vFjE/biRCTww+E0EzM7oNaqT4yRiQqb5w4dqYj9TQmRdhnkZeug5/rJe 984Q== 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=vUE8AEfpv1Je3ytswJ2t5UjmrKOaLm5nTOW/OGZXKqs=; b=i/PV790HYbbvudLmDWf7VeKvmG1ePspD27a+IMIMZ3DpDa1qMe8Zw061+8PGJQ4giM 4WPr2OeTBmJxN+IIQ986kVmtx2K1k61N4Sil/J9ZZLVJVQel7ErR45KEkQxWF5lE1onX /osmbNozDQKQ3DO7TLI6wGLxZgsuqPZdxhrXFhU33K3GNtNaL53MdTbYz+Y8JOJ4lZ+j QrD2Xb7U+tuN3kV/Y2f/2/qsYbR4K05HxuwFR0MwhwSfu87QOsIXvOpyp+Wc/lMBnDds E8Fb0siqBFqKETUrHMtowLYQxwTgifSkBiN+Jldev6vOC2lgYhIbpSfsg/DDb4bsHth1 xi9Q== X-Gm-Message-State: APjAAAVTrboTUMk5PcmDTh3SbpeO+d5s45o6lnF3rRD1FIWAnewgFK2W YODPgxPTgtAN9zxYfltV8nuhuTO62omAxnnlkY8= X-Received: by 2002:ad4:4e34:: with SMTP id dm20mr14796667qvb.163.1576256550460; Fri, 13 Dec 2019 09:02:30 -0800 (PST) MIME-Version: 1.0 References: <20191201195728.4161537-1-aurelien@aurel32.net> <87zhgbe0ix.fsf@mpe.ellerman.id.au> <20191202093752.GA1535@localhost.localdomain> <20191210222553.GA4580@calabresa> <20191211160133.GB4580@calabresa> <20191213101114.GA3986@calabresa> In-Reply-To: <20191213101114.GA3986@calabresa> From: Andrii Nakryiko Date: Fri, 13 Dec 2019 09:02:19 -0800 Message-ID: Subject: Re: [PATCH] libbpf: Fix readelf output parsing for Fedora To: Thadeu Lima de Souza Cascardo Cc: Justin Forbes , Daniel Borkmann , Song Liu , Andrii Nakryiko , Alexei Starovoitov , LKML , "open list:BPF (Safe dynamic programs and tools)" , Yonghong Song , "open list:BPF (Safe dynamic programs and tools)" , linuxppc-dev@lists.ozlabs.org, Martin KaFai Lau , Aurelien Jarno , debian-kernel@lists.debian.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 13, 2019 at 2:11 AM Thadeu Lima de Souza Cascardo wrote: > > Fedora binutils has been patched to show "other info" for a symbol at the > end of the line. This was done in order to support unmaintained scripts > that would break with the extra info. [1] > > [1] https://src.fedoraproject.org/rpms/binutils/c/b8265c46f7ddae23a792ee8306fbaaeacba83bf8 > > This in turn has been done to fix the build of ruby, because of checksec. > [2] Thanks Michael Ellerman for the pointer. > > [2] https://bugzilla.redhat.com/show_bug.cgi?id=1479302 > > As libbpf Makefile is not unmaintained, we can simply deal with either > output format, by just removing the "other info" field, as it always comes > inside brackets. > > Cc: Aurelien Jarno > Fixes: 3464afdf11f9 (libbpf: Fix readelf output parsing on powerpc with recent binutils) > Reported-by: Justin Forbes > Signed-off-by: Thadeu Lima de Souza Cascardo > --- I was briefly playing with it and trying to make it use nm to dump symbols, instead of parsing more human-oriented output of readelf, but somehow nm doesn't output symbols with @@LIBBPF.* suffix at the end, so I just gave up. So I think this one is good. This should go through bpf-next tree. Acked-by: Andrii Nakryiko > tools/lib/bpf/Makefile | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile > index defae23a0169..23ae06c43d08 100644 > --- a/tools/lib/bpf/Makefile > +++ b/tools/lib/bpf/Makefile > @@ -147,6 +147,7 @@ TAGS_PROG := $(if $(shell which etags 2>/dev/null),etags,ctags) > > GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \ > cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ > + sed 's/\[.*\]//' | \ > awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ > sort -u | wc -l) > VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \ > @@ -213,6 +214,7 @@ check_abi: $(OUTPUT)libbpf.so > "versioned in $(VERSION_SCRIPT)." >&2; \ > readelf -s --wide $(BPF_IN_SHARED) | \ > cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ > + sed 's/\[.*\]//' | \ > awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ > sort -u > $(OUTPUT)libbpf_global_syms.tmp; \ > readelf -s --wide $(OUTPUT)libbpf.so | \ > -- > 2.24.0 >