Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1154990ybl; Sun, 1 Dec 2019 21:54:56 -0800 (PST) X-Google-Smtp-Source: APXvYqxRU26kZamnjUDkqpYyxN39JxHyPNzf3UFlstr/s2KStg0vmsgArhMLlIRhdSmn+Pde5G1Y X-Received: by 2002:a17:907:104a:: with SMTP id oy10mr16149739ejb.324.1575266096658; Sun, 01 Dec 2019 21:54:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575266096; cv=none; d=google.com; s=arc-20160816; b=0A8P35ao67PtInw2h8jWv34HAVqvB19/mRJeeDFILCupGQRydkN50UdoFco0YI7KcS P+VOQIH24TTJk1ou2nnpNLgzkC6Bwfl3sp+VpTvihtBEA5KOORk8utf9f/bNDHgE5Qoe 8sHbDaorR1ey6oHdpq3yLjWTqfk4udF3o+RriYVtWAJMSQVnA+u23kyJiuWPJNBCww0g J37JI8HHe2gPRL1nxiQJOBjmYysADZHFlNFbob+9zu3yxjczry9J9s5CouKsA//OEt4R CEWTDj3Vrf7P9tKp31m1E3QctcZZbv+jHfIYyf5tr4zw/HMsVJAjkhfXNvOLB6t74B1L 4cjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=+pu6Rb6ZbiQWd3Q0lu5xjfEN/YCgyLTZBiDLtBgrpqk=; b=YcdnbIWY/oG08GqjPweJ52NmZEDS/1k8X/w0Tw1UVhhWQp4ymrlHYw0LuJUjlJ3qbn q5Jiu3eqoGisoCt7LRvKn5QKsx+syX/2pwr8p1uhzK/RZpkJtaXq3tn0KXq699Lsy/9s VMLxL0mvP4+TgbahQebI+PJ5WTobGmkl1PuDcFfqcgC+LUN72ThAYk8u/i1BOFyvh0k0 ACg54/+KZap3bBQ6Fx5FFSPh8WbxTMIX4rP5P11MS4UVwqTIYKujz2tM+RmxQqAhZFhU vRBn2l2owDFbYwFJs6MR2BX7ZUoWoy7LE6q1K5Au6a1c5LUp4imdGSS0eyPehKyWeFSY iiZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=noH5xNFo; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g12si3859785ejp.353.2019.12.01.21.54.30; Sun, 01 Dec 2019 21:54:56 -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=@ellerman.id.au header.s=201909 header.b=noH5xNFo; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726339AbfLBFxa (ORCPT + 99 others); Mon, 2 Dec 2019 00:53:30 -0500 Received: from ozlabs.org ([203.11.71.1]:56981 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725807AbfLBFxa (ORCPT ); Mon, 2 Dec 2019 00:53:30 -0500 Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 47RDn32QZ8z9sPL; Mon, 2 Dec 2019 16:53:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1575266008; bh=EH+luGXjEilyQ8e+4eAH4LRNqk79yUFe6oQvFYlUr4k=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=noH5xNFoZXpnOmGLtGuWcghVmhFwCLZEThi4IM+78KPiDy/A0K25QrTucZRFgHP4w p2UM2USUd7MJu6d/A3e/ccqQDysB0pqm//W3VLWOjSJkms+GcIcpkZBglp3shAkzHi RZjxs5MUi7Nr6wZG0CZoxOL4RIqdc2dVDsEY/IGWMv0fCVY89W6dj1rFiZxl2I2Ypr f1S3RlnKxSPmoNNdJ0AicXhAYf/uqa2zcQMFULONaZNMVJthAQMinzzwXbfXBu51PT Dlux5u8JToEHyTEfhuOlQpqbXMouCkWZi+nWI+na3hSy6B9D1f6/pFDHTJb5DjlUoB k0lXg7QDgxh0A== From: Michael Ellerman To: Aurelien Jarno , linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, debian-kernel@lists.debian.org, Aurelien Jarno , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , "open list\:BPF \(Safe dynamic programs and tools\)" , "open list\:BPF \(Safe dynamic programs and tools\)" Subject: Re: [PATCH] libbpf: fix readelf output parsing on powerpc with recent binutils In-Reply-To: <20191201195728.4161537-1-aurelien@aurel32.net> References: <20191201195728.4161537-1-aurelien@aurel32.net> Date: Mon, 02 Dec 2019 16:53:26 +1100 Message-ID: <87zhgbe0ix.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Aurelien Jarno writes: > On powerpc with recent versions of binutils, readelf outputs an extra > field when dumping the symbols of an object file. For example: > > 35: 0000000000000838 96 FUNC LOCAL DEFAULT [: 8] 1 btf_is_struct > > The extra "[: 8]" prevents the GLOBAL_SYM_COUNT variable to > be computed correctly and causes the checkabi target to fail. > > Fix that by looking for the symbol name in the last field instead of the > 8th one. This way it should also cope with future extra fields. > > Signed-off-by: Aurelien Jarno > --- > tools/lib/bpf/Makefile | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Thanks for fixing that, it's been on my very long list of test failures for a while. Tested-by: Michael Ellerman cheers > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile > index 99425d0be6ff..333900cf3f4f 100644 > --- a/tools/lib/bpf/Makefile > +++ b/tools/lib/bpf/Makefile > @@ -147,7 +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].*//' | \ > - awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}' | \ > + awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ > sort -u | wc -l) > VERSIONED_SYM_COUNT = $(shell readelf -s --wide $(OUTPUT)libbpf.so | \ > grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l) > @@ -216,7 +216,7 @@ check_abi: $(OUTPUT)libbpf.so > "versioned in $(VERSION_SCRIPT)." >&2; \ > readelf -s --wide $(OUTPUT)libbpf-in.o | \ > cut -d "@" -f1 | sed 's/_v[0-9]_[0-9]_[0-9].*//' | \ > - awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}'| \ > + awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ > sort -u > $(OUTPUT)libbpf_global_syms.tmp; \ > readelf -s --wide $(OUTPUT)libbpf.so | \ > grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \ > -- > 2.24.0