提交 67fbe6c6 编写于 作者: R Rongwei Wang 提交者: Shile Zhang

lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure

to #26730415

commit ff98e20ef2081b8620dada28fc2d4fb24ca0abf2 upstream.

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.
Acked-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: NLaura Abbott <labbott@redhat.com>
Signed-off-by: NMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Signed-off-by: NRongwei Wang <rongwei.wang@linux.alibaba.com>
Acked-by: NZou Cao <zoucao@linux.alibaba.com>
上级 acc2d05a
...@@ -206,8 +206,8 @@ u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len) ...@@ -206,8 +206,8 @@ u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
EXPORT_SYMBOL(crc32_le); EXPORT_SYMBOL(crc32_le);
EXPORT_SYMBOL(__crc32c_le); EXPORT_SYMBOL(__crc32c_le);
u32 crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le); u32 __pure 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 __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
/* /*
* This multiplies the polynomials x and y modulo the given modulus. * This multiplies the polynomials x and y modulo the given modulus.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册