From patchwork Sun Jan 28 22:58:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Forney X-Patchwork-Id: 10188329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C974960383 for ; Sun, 28 Jan 2018 22:59:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCDFF2858A for ; Sun, 28 Jan 2018 22:59:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0854286D7; Sun, 28 Jan 2018 22:59:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 375492858A for ; Sun, 28 Jan 2018 22:59:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753660AbeA1W7b (ORCPT ); Sun, 28 Jan 2018 17:59:31 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:40967 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753540AbeA1W73 (ORCPT ); Sun, 28 Jan 2018 17:59:29 -0500 Received: by mail-pf0-f194.google.com with SMTP id c6so3233259pfi.8 for ; Sun, 28 Jan 2018 14:59:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mforney-org.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=LJSzHLqWtyN0gAVwzoLROziuYbyk8WMjlDXfpk8f8Bs=; b=AWDsWJBJOQiQuZS/rahoICPY8c8FRufPPZ5JA+0p0NomrfMEw+BXiuSaSRTIMW6pCD LrX4UgBpwqDgf5usHX7GhIkeXjv44vq8kysocuHyI8CjQ3o+q9sgzelWjb3SvUiCwQLs S9i7cN0d70FA/s4mZv8I7WqEjy9ShcG2ahlRg1BptefwlHsYD4DHqc1btgt+wBfTzyhO G5DJIDqUkbCC09ulrC0A3uIO5q1hxs5D+nxekN0QYSChdV/pZGHS7j7NQKAxoaQyrHGI Nfw1Juu9OTlJHClf6uEPjn/hEwKS2hiu0ulbKiVdb9FTKZbdB2XXun9bFGKyK2TLjJb8 HRlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=LJSzHLqWtyN0gAVwzoLROziuYbyk8WMjlDXfpk8f8Bs=; b=XXgwbWkYZQC/OHViSUCuirqqTO4Se8gydsb4BwAg/EXvat3As1l0zKg6XL2c3XYcNp 6dVXs7YxBmYlHMWHKzhwW6Cta6Qw3mlvKVshWCPxLwOQpvEImcMo6h/BkEzGfNfSvtEK tUVy3/Nd9zBn5IXt1KL/Cjk2p4EOnDfXXH6kuSlR6gcVXP8qL4f1w8+Hm4R8fYk7FOgW o8JeCaJ+ENHynIv/P/WooBATEPqq8nRduH1iRGwk1lv4KIjSRIdjJXz9kiF+jiEWYeT7 SG8Z/qZgjiPMdrlJNuwx+1vQ44cTrTycby2hAN3vXkQVPKos50UruaBFFLlffBwxuVg6 LhBg== X-Gm-Message-State: AKwxytc1qbA/9LGsMQrUMKzAv70aik7HwGaxTfORHyYIrDn59WpETHy9 snJmOFfmPgmnbLxQC49m9DCZru6rUQw= X-Google-Smtp-Source: AH8x2247++buG4A0a+rWgT3raTVz0Fh59ovdGvEZeMc96RgqXpiKsyIcpx9gZyjRoeFRFBOm3pUd/A== X-Received: by 10.98.64.208 with SMTP id f77mr24734375pfd.157.1517180369079; Sun, 28 Jan 2018 14:59:29 -0800 (PST) Received: from localhost ([2601:647:5100:1da4::70af]) by smtp.gmail.com with ESMTPSA id k90sm27378345pfk.171.2018.01.28.14.59.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Jan 2018 14:59:28 -0800 (PST) From: Michael Forney To: linux-kbuild@vger.kernel.org Subject: [PATCH] kbuild: Use ls(1) instead of stat(1) to obtain file size Date: Sun, 28 Jan 2018 14:58:38 -0800 Message-Id: <20180128225838.1275-1-mforney@mforney.org> X-Mailer: git-send-email 2.15.1 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Michael Forney stat(1) is not standardized and different implementations have their own (conflicting) flags for querying the size of a file. ls(1) provides the same information (value of st.st_size) in the 5th column, except when the file is a character or block device. Signed-off-by: Michael Forney --- scripts/Makefile.lib | 3 ++- scripts/link-vmlinux.sh | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7dee1da83e2a..24566d1c10d2 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -319,7 +319,8 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) size_append = printf $(shell \ dec_size=0; \ for F in $1; do \ - fsize=$$(stat -c "%s" $$F); \ + set -- $$(ls -dn $$F); \ + fsize=$$5; \ dec_size=$$(expr $$dec_size + $$fsize); \ done; \ printf "%08x\n" $$dec_size | \ diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index c0d129d7f430..4a5737647a79 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -296,8 +296,10 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then kallsyms .tmp_vmlinux2 .tmp_kallsyms2.o # step 3 - size1=$(stat -c "%s" .tmp_kallsyms1.o) - size2=$(stat -c "%s" .tmp_kallsyms2.o) + set -- $(ls -dn .tmp_kallsyms1.o) + size1=$5 + set -- $(ls -dn .tmp_kallsyms2.o) + size2=$5 if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then kallsymso=.tmp_kallsyms3.o