From patchwork Thu Oct 10 16:06:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 50252 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21DA8CFC5E4 for ; Thu, 10 Oct 2024 16:06:41 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.47647.1728576393519270397 for ; Thu, 10 Oct 2024 09:06:33 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9EA01497 for ; Thu, 10 Oct 2024 09:07:02 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AAD7A3F58B for ; Thu, 10 Oct 2024 09:06:32 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH v2 05/11] insane: only parse ELFs if they're files, not symlinks Date: Thu, 10 Oct 2024 17:06:17 +0100 Message-Id: <20241010160623.2880937-5-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010160623.2880937-1-ross.burton@arm.com> References: <20241010160623.2880937-1-ross.burton@arm.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 10 Oct 2024 16:06:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/205414 This reduces the number of files that need to be swept by not scanning eg the library symlinks, and means we can remove the explicit islink() checks in many of the tests. Signed-off-by: Ross Burton --- meta/classes-global/insane.bbclass | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index 1691d96b64a..7f01908e18e 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass @@ -122,9 +122,6 @@ def package_qa_check_rpath(file,name, d, elf): if not elf: return - if os.path.islink(file): - return - bad_dirs = [d.getVar('BASE_WORKDIR'), d.getVar('STAGING_DIR_TARGET')] phdrs = elf.run_objdump("-p", d) @@ -150,9 +147,6 @@ def package_qa_check_useless_rpaths(file, name, d, elf): if not elf: return - if os.path.islink(file): - return - libdir = d.getVar("libdir") base_libdir = d.getVar("base_libdir") @@ -337,11 +331,6 @@ def package_qa_check_arch(path,name,d, elf): oe.qa.handle_error("arch", pn + ": Recipe inherits the allarch class, but has packaged architecture-specific binaries", d) return - # avoid following links to /usr/bin (e.g. on udev builds) - # we will check the files pointed to anyway... - if os.path.islink(path): - return - #if this will throw an exception, then fix the dict above (machine, osabi, abiversion, littleendian, bits) \ = oe.elf.machine_dict(d)[host_os][host_arch] @@ -383,9 +372,6 @@ def package_qa_textrel(path, name, d, elf): if not elf: return - if os.path.islink(path): - return - phdrs = elf.run_objdump("-p", d) import re @@ -405,9 +391,6 @@ def package_qa_hash_style(path, name, d, elf): if not elf: return - if os.path.islink(path): - return - gnu_hash = "--hash-style=gnu" in d.getVar('LDFLAGS') if not gnu_hash: gnu_hash = "--hash-style=both" in d.getVar('LDFLAGS') @@ -601,7 +584,7 @@ def check_32bit_symbols(path, packagename, d, elf): ) # elf is a oe.qa.ELFFile object - if elf is not None: + if elf: phdrs = elf.run_objdump("-tw", d) syms = re.finditer(ptrn, phdrs) usedapis = {sym.group('notag') for sym in syms} @@ -789,7 +772,7 @@ def package_qa_walk(checkfuncs, package, d): elves = {} for path in pkgfiles[package]: elf = None - if os.path.isfile(path): + if os.path.isfile(path) and not os.path.islink(path): elf = oe.qa.ELFFile(path) try: elf.open()