* [PATCH] lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure
@ 2019-01-24 15:44 Miguel Ojeda
2019-01-25 10:14 ` Ard Biesheuvel
2019-01-25 10:46 ` Laura Abbott
0 siblings, 2 replies; 3+ messages in thread
From: Miguel Ojeda @ 2019-01-24 15:44 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Laura Abbott, Herbert Xu, Ard Biesheuvel, Catalin Marinas,
Martin Sebor, linux-kernel
The upcoming GCC 9 release extends the -Wmissing-attributes warnings
(enabled by -Wall) to C and aliases: it warns when particular function
attributes are missing in the aliases but not in their target.
In particular, it triggers here because crc32_le_base/__crc32c_le_base
aren't __pure while their target crc32_le/__crc32c_le are.
These aliases are used by architectures as a fallback in accelerated
versions of CRC32. See commit 9784d82db3eb ("lib/crc32: make core crc32()
routines weak so they can be overridden").
Therefore, being fallbacks, it is likely that even if the aliases
were called from C, there wouldn't be any optimizations possible.
Currently, the only user is arm64, which calls this from asm.
Still, marking the aliases as __pure makes sense and is a good idea
for documentation purposes and possible future optimizations,
which also silences the warning.
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
---
I am picking this up through the compiler-attributes tree
and putting it into -next along with the other cleanup
for -Wmissing-attributes (unless some other maintainer wants it).
lib/crc32.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/crc32.c b/lib/crc32.c
index 45b1d67a1767..4a20455d1f61 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -206,8 +206,8 @@ u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
EXPORT_SYMBOL(crc32_le);
EXPORT_SYMBOL(__crc32c_le);
-u32 crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
-u32 __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
+u32 __pure crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
+u32 __pure __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
/*
* This multiplies the polynomials x and y modulo the given modulus.
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure
2019-01-24 15:44 [PATCH] lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure Miguel Ojeda
@ 2019-01-25 10:14 ` Ard Biesheuvel
2019-01-25 10:46 ` Laura Abbott
1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2019-01-25 10:14 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Krzysztof Kozlowski, Laura Abbott, Herbert Xu, Catalin Marinas,
Martin Sebor, Linux Kernel Mailing List
On Thu, 24 Jan 2019 at 16:44, Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> The upcoming GCC 9 release extends the -Wmissing-attributes warnings
> (enabled by -Wall) to C and aliases: it warns when particular function
> attributes are missing in the aliases but not in their target.
>
> In particular, it triggers here because crc32_le_base/__crc32c_le_base
> aren't __pure while their target crc32_le/__crc32c_le are.
>
> These aliases are used by architectures as a fallback in accelerated
> versions of CRC32. See commit 9784d82db3eb ("lib/crc32: make core crc32()
> routines weak so they can be overridden").
>
> Therefore, being fallbacks, it is likely that even if the aliases
> were called from C, there wouldn't be any optimizations possible.
> Currently, the only user is arm64, which calls this from asm.
>
> Still, marking the aliases as __pure makes sense and is a good idea
> for documentation purposes and possible future optimizations,
> which also silences the warning.
>
> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> I am picking this up through the compiler-attributes tree
> and putting it into -next along with the other cleanup
> for -Wmissing-attributes (unless some other maintainer wants it).
>
> lib/crc32.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/crc32.c b/lib/crc32.c
> index 45b1d67a1767..4a20455d1f61 100644
> --- a/lib/crc32.c
> +++ b/lib/crc32.c
> @@ -206,8 +206,8 @@ u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
> EXPORT_SYMBOL(crc32_le);
> EXPORT_SYMBOL(__crc32c_le);
>
> -u32 crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
> -u32 __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
> +u32 __pure crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
> +u32 __pure __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
>
> /*
> * This multiplies the polynomials x and y modulo the given modulus.
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure
2019-01-24 15:44 [PATCH] lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure Miguel Ojeda
2019-01-25 10:14 ` Ard Biesheuvel
@ 2019-01-25 10:46 ` Laura Abbott
1 sibling, 0 replies; 3+ messages in thread
From: Laura Abbott @ 2019-01-25 10:46 UTC (permalink / raw)
To: Miguel Ojeda, Krzysztof Kozlowski
Cc: Herbert Xu, Ard Biesheuvel, Catalin Marinas, Martin Sebor,
linux-kernel
On 1/24/19 7:44 AM, Miguel Ojeda wrote:
> The upcoming GCC 9 release extends the -Wmissing-attributes warnings
> (enabled by -Wall) to C and aliases: it warns when particular function
> attributes are missing in the aliases but not in their target.
>
> In particular, it triggers here because crc32_le_base/__crc32c_le_base
> aren't __pure while their target crc32_le/__crc32c_le are.
>
> These aliases are used by architectures as a fallback in accelerated
> versions of CRC32. See commit 9784d82db3eb ("lib/crc32: make core crc32()
> routines weak so they can be overridden").
>
> Therefore, being fallbacks, it is likely that even if the aliases
> were called from C, there wouldn't be any optimizations possible.
> Currently, the only user is arm64, which calls this from asm.
>
> Still, marking the aliases as __pure makes sense and is a good idea
> for documentation purposes and possible future optimizations,
> which also silences the warning.
>
> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
> ---
> I am picking this up through the compiler-attributes tree
> and putting it into -next along with the other cleanup
> for -Wmissing-attributes (unless some other maintainer wants it).
>
> lib/crc32.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/crc32.c b/lib/crc32.c
> index 45b1d67a1767..4a20455d1f61 100644
> --- a/lib/crc32.c
> +++ b/lib/crc32.c
> @@ -206,8 +206,8 @@ u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
> EXPORT_SYMBOL(crc32_le);
> EXPORT_SYMBOL(__crc32c_le);
>
> -u32 crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
> -u32 __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
> +u32 __pure crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
> +u32 __pure __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
>
> /*
> * This multiplies the polynomials x and y modulo the given modulus.
>
Tested-by: Laura Abbott <labbott@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-25 10:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-24 15:44 [PATCH] lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure Miguel Ojeda
2019-01-25 10:14 ` Ard Biesheuvel
2019-01-25 10:46 ` Laura Abbott
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox