Skip to content

Commit efa7ceb

Browse files
Ard Biesheuvelherbertx
authored andcommitted
crypto: arm/crc32 - add build time test for CRC instruction support
The accelerated CRC32 module for ARM may use either the scalar CRC32 instructions, the NEON 64x64 to 128 bit polynomial multiplication (vmull.p64) instruction, or both, depending on what the current CPU supports. However, this also requires support in binutils, and as it turns out, versions of binutils exist that support the vmull.p64 instruction but not the crc32 instructions. So refactor the Makefile logic so that this module only gets built if binutils has support for both. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 1fb1683 commit efa7ceb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

arch/arm/crypto/Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@ ce-obj-$(CONFIG_CRYPTO_SHA1_ARM_CE) += sha1-arm-ce.o
1515
ce-obj-$(CONFIG_CRYPTO_SHA2_ARM_CE) += sha2-arm-ce.o
1616
ce-obj-$(CONFIG_CRYPTO_GHASH_ARM_CE) += ghash-arm-ce.o
1717
ce-obj-$(CONFIG_CRYPTO_CRCT10DIF_ARM_CE) += crct10dif-arm-ce.o
18-
ce-obj-$(CONFIG_CRYPTO_CRC32_ARM_CE) += crc32-arm-ce.o
18+
crc-obj-$(CONFIG_CRYPTO_CRC32_ARM_CE) += crc32-arm-ce.o
19+
20+
ifneq ($(crc-obj-y)$(crc-obj-m),)
21+
ifeq ($(call as-instr,.arch armv8-a\n.arch_extension crc,y,n),y)
22+
ce-obj-y += $(crc-obj-y)
23+
ce-obj-m += $(crc-obj-m)
24+
else
25+
$(warning These CRC Extensions modules need binutils 2.23 or higher)
26+
$(warning $(crc-obj-y) $(crc-obj-m))
27+
endif
28+
endif
1929

2030
ifneq ($(ce-obj-y)$(ce-obj-m),)
2131
ifeq ($(call as-instr,.fpu crypto-neon-fp-armv8,y,n),y)

0 commit comments

Comments
 (0)