a4462ff
From patchwork Thu Jan 24 15:44:20 2019
a4462ff
Content-Type: text/plain; charset="utf-8"
a4462ff
MIME-Version: 1.0
a4462ff
Content-Transfer-Encoding: 7bit
a4462ff
X-Patchwork-Submitter: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
a4462ff
X-Patchwork-Id: 1035252
a4462ff
Return-Path: <SRS0=jJS3=QA=vger.kernel.org=linux-kernel-owner@kernel.org>
a4462ff
Received: from mail.kernel.org (mail.kernel.org [198.145.29.99])
a4462ff
	by smtp.lore.kernel.org (Postfix) with ESMTP id 95925C282C3
a4462ff
	for <linux-kernel@archiver.kernel.org>; Thu, 24 Jan 2019 15:44:28 +0000 (UTC)
a4462ff
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
a4462ff
	by mail.kernel.org (Postfix) with ESMTP id 6368521872
a4462ff
	for <linux-kernel@archiver.kernel.org>; Thu, 24 Jan 2019 15:44:28 +0000 (UTC)
a4462ff
Authentication-Results: mail.kernel.org;
a4462ff
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com
a4462ff
 header.b="DEOxuN9k"
a4462ff
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
a4462ff
        id S1728590AbfAXPo1 (ORCPT
a4462ff
        <rfc822;linux-kernel@archiver.kernel.org>);
a4462ff
        Thu, 24 Jan 2019 10:44:27 -0500
a4462ff
Received: from mail-wm1-f68.google.com ([209.85.128.68]:37788 "EHLO
a4462ff
        mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
a4462ff
        with ESMTP id S1727649AbfAXPo0 (ORCPT
a4462ff
        <rfc822;linux-kernel@vger.kernel.org>);
a4462ff
        Thu, 24 Jan 2019 10:44:26 -0500
a4462ff
Received: by mail-wm1-f68.google.com with SMTP id g67so3548002wmd.2
a4462ff
        for <linux-kernel@vger.kernel.org>;
a4462ff
 Thu, 24 Jan 2019 07:44:25 -0800 (PST)
a4462ff
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
a4462ff
        d=gmail.com; s=20161025;
a4462ff
        h=date:from:to:cc:subject:message-id:mime-version:content-disposition
a4462ff
         :user-agent;
a4462ff
        bh=JeyLhzrsCRzzO/4nbb0LJSQxILVpgC++VcQqugacalc=;
a4462ff
        b=DEOxuN9kV3A3qQ3ere0UjnfgT3DE1Gc4z/52Qty46F/mbpPja2OkXvtPJ15RK9/h4Z
a4462ff
         AG1fdkKf/GjCRaBidO9BLWwcoq0uiTV69J0KR0rF67QR9zxgGVEl8fu6s/ZmtKnnIdF4
a4462ff
         AysPfOHY+/MwlcB6UOzADtS69SDUYTsxDxOfHBj/FjnS7WmNetq8ae17VvRdpd/JEWtE
a4462ff
         M58OhgBYmckFYuVXQTEEhpm8w6TIefPA5S3r3KeUuXclMeqJ07pU1vJWK7tdTp7sIeAv
a4462ff
         xYgGq49/NBPkUl4l+LdwVBwp+o6pvUfh2w9zBQW67xZu6rn/j500BV8xdubxQqHTauSM
a4462ff
         oQPw==
a4462ff
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
a4462ff
        d=1e100.net; s=20161025;
a4462ff
        h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version
a4462ff
         :content-disposition:user-agent;
a4462ff
        bh=JeyLhzrsCRzzO/4nbb0LJSQxILVpgC++VcQqugacalc=;
a4462ff
        b=twekOdboep908h8e5de5qIQIgDuUrOYeS/p8s5bh3AYpMD9r3CIJtanHSCWnFCsPIw
a4462ff
         /hesYDvbpVSiQTI1afBap2tw2ugq2aL2Sur2/9BhWE5So2HlVMlN5M6S8ccs6IK6Ldzh
a4462ff
         +wxWJnq7dnvwbpMLcT3mASpdlEUPTaVTA7AazIssYrIDY9ucJA4vfYUemvvTtKn2tovO
a4462ff
         lJjVDsOwv7/3P9XphLneTUXTI1ZD9soUX/qpt1m4n4BAme1tHfmbAL4cceRfMf7eFKhh
a4462ff
         t3iRpkh/6ZHMGw0moeXPkTB+WTDhA7MgsmQA/X6tmPfjfMQsEo+OKRUBtFuuVDY5wzSf
a4462ff
         eX7Q==
a4462ff
X-Gm-Message-State: AJcUukcM8ZahlKLufK0H1V2XtT0GIN899FyU1V2PJM0+/GfK3XvzMW2n
a4462ff
        o0kPoin07YrKIK/Zh71qAxI=
a4462ff
X-Google-Smtp-Source: 
a4462ff
 ALg8bN7upuyKWCD/cTB9FAkdcEyU6dlTStUcg49cEAv640NugO83fRipoQ9X2YGpIogSFxA7BbHmeQ==
a4462ff
X-Received: by 2002:a1c:bbd6:: with SMTP id l205mr2979576wmf.97.1548344665032;
a4462ff
        Thu, 24 Jan 2019 07:44:25 -0800 (PST)
a4462ff
Received: from gmail.com (79.108.96.12.dyn.user.ono.com. [79.108.96.12])
a4462ff
        by smtp.gmail.com with ESMTPSA id
a4462ff
 k128sm80898610wmd.37.2019.01.24.07.44.23
a4462ff
        (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
a4462ff
        Thu, 24 Jan 2019 07:44:24 -0800 (PST)
a4462ff
Date: Thu, 24 Jan 2019 16:44:20 +0100
a4462ff
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
a4462ff
To: Krzysztof Kozlowski <krzk@kernel.org>
a4462ff
Cc: Laura Abbott <labbott@redhat.com>,
a4462ff
        Herbert Xu <herbert@gondor.apana.org.au>,
a4462ff
        Ard Biesheuvel <ard.biesheuvel@linaro.org>,
a4462ff
        Catalin Marinas <catalin.marinas@arm.com>,
a4462ff
        Martin Sebor <msebor@gcc.gnu.org>, linux-kernel@vger.kernel.org
a4462ff
Subject: [PATCH] lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as
a4462ff
 __pure
a4462ff
Message-ID: <20190124154420.GA11471@gmail.com>
a4462ff
MIME-Version: 1.0
a4462ff
Content-Type: text/plain; charset=us-ascii
a4462ff
Content-Disposition: inline
a4462ff
User-Agent: elm/2
a4462ff
Sender: linux-kernel-owner@vger.kernel.org
a4462ff
Precedence: bulk
a4462ff
List-ID: <linux-kernel.vger.kernel.org>
a4462ff
X-Mailing-List: linux-kernel@vger.kernel.org
a4462ff
a4462ff
The upcoming GCC 9 release extends the -Wmissing-attributes warnings
a4462ff
(enabled by -Wall) to C and aliases: it warns when particular function
a4462ff
attributes are missing in the aliases but not in their target.
a4462ff
a4462ff
In particular, it triggers here because crc32_le_base/__crc32c_le_base
a4462ff
aren't __pure while their target crc32_le/__crc32c_le are.
a4462ff
a4462ff
These aliases are used by architectures as a fallback in accelerated
a4462ff
versions of CRC32. See commit 9784d82db3eb ("lib/crc32: make core crc32()
a4462ff
routines weak so they can be overridden").
a4462ff
a4462ff
Therefore, being fallbacks, it is likely that even if the aliases
a4462ff
were called from C, there wouldn't be any optimizations possible.
a4462ff
Currently, the only user is arm64, which calls this from asm.
a4462ff
a4462ff
Still, marking the aliases as __pure makes sense and is a good idea
a4462ff
for documentation purposes and possible future optimizations,
a4462ff
which also silences the warning.
a4462ff
a4462ff
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
a4462ff
---
a4462ff
I am picking this up through the compiler-attributes tree
a4462ff
and putting it into -next along with the other cleanup
a4462ff
for -Wmissing-attributes (unless some other maintainer wants it).
a4462ff
a4462ff
 lib/crc32.c | 4 ++--
a4462ff
 1 file changed, 2 insertions(+), 2 deletions(-)
a4462ff
a4462ff
diff --git a/lib/crc32.c b/lib/crc32.c
a4462ff
index 45b1d67a1767..4a20455d1f61 100644
a4462ff
--- a/lib/crc32.c
a4462ff
+++ b/lib/crc32.c
a4462ff
@@ -206,8 +206,8 @@ u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
a4462ff
 EXPORT_SYMBOL(crc32_le);
a4462ff
 EXPORT_SYMBOL(__crc32c_le);
a4462ff
 
a4462ff
-u32 crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
a4462ff
-u32 __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
a4462ff
+u32 __pure crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
a4462ff
+u32 __pure __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
a4462ff
 
a4462ff
 /*
a4462ff
  * This multiplies the polynomials x and y modulo the given modulus.