-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling with -march=armv8-a+crc+nocrypto results in linking error #7042
Comments
To decipher
|
I understand the meaning of these flags. I could workaround this issue by using |
@Fugoes Sure. I didn't understand the flags though - which is why I added them for my own reference ;-) |
What's more, most aarch64 server or high ends Android phone should have both crc and crypto I think. I encounter this issue on a raspberry pi 4 b XD. |
For those who created the file, @HouBingjian , @Zhiwei-Dai and @guyuqi any thought how we should resolve this? |
In addition to the flags discussion here (that I'm following closely) note that @guyuqi who submitted the same code to mariadb (MariaDB/server#772) missed a |
Yep, |
MariaDB/server#1645 introduces a revised runtime check for the CRC-32C acceleration: int crc32c_aarch64_available(void)
{
return !(~getauxval(AT_HWCAP) & (HWCAP_CRC32 | HWCAP_PMULL));
} I expect to merge it as soon as it has been validated on a ( |
Summary: Issue:#7042 No PMULL runtime check will lead to SIGILL on a Raspberry pi 4. Leverage 'getauxval' to get Hardware-Cap to detect whether target platform does support PMULL or not in runtime. Consider the condition that the target platform does support crc32 but not support PMULL. In this condition, the code should leverage the crc32 instruction rather than skip all hardware crc32 instruction. Pull Request resolved: #7233 Reviewed By: jay-zhuang Differential Revision: D23790116 fbshipit-source-id: a3ebd821fbd4a38dd2f59064adbb7c3013ee8140
Summary: Issue:facebook#7042 No PMULL runtime check will lead to SIGILL on a Raspberry pi 4. Leverage 'getauxval' to get Hardware-Cap to detect whether target platform does support PMULL or not in runtime. Consider the condition that the target platform does support crc32 but not support PMULL. In this condition, the code should leverage the crc32 instruction rather than skip all hardware crc32 instruction. Pull Request resolved: facebook#7233 Reviewed By: jay-zhuang Differential Revision: D23790116 fbshipit-source-id: a3ebd821fbd4a38dd2f59064adbb7c3013ee8140
Summary: Issue:facebook#7042 No PMULL runtime check will lead to SIGILL on a Raspberry pi 4. Leverage 'getauxval' to get Hardware-Cap to detect whether target platform does support PMULL or not in runtime. Consider the condition that the target platform does support crc32 but not support PMULL. In this condition, the code should leverage the crc32 instruction rather than skip all hardware crc32 instruction. Pull Request resolved: facebook#7233 Reviewed By: jay-zhuang Differential Revision: D23790116 fbshipit-source-id: a3ebd821fbd4a38dd2f59064adbb7c3013ee8140 (cherry picked from commit 29f7bbe)
@Fugoes I'd like to know how you did compile RocksDB shared library. I'm trying to reproduce the same problem but I couldn't. |
Since #7233 is merged, should we close this one? |
I have acquired a Pi 4 B and explicitly built the shared lib at HEAD with nocrypto (-march=armv8-a+crc+nocrypto) instead of the current default of (-march=armv8-a+crc+crypto). In both cases, the symbols reported missing above are found, and the snippet compiles and runs successfully as I am using 64bit PiOS.
NOTE ALSO that the 4B DOES support armv8-a crypto instructions, it has a cortex-a72 as described in https://developer.arm.com/documentation/100097/0003/introduction/about-the-cortex-a72-processor-cryptography-engine?lang=en It does not seem possible to build 5.18 with the current toolchain, so testing whether the problem is reproducible there has not been done. But
and undefined without
It seems then, that the reported SIGILL is the one fixed by #7233 tldr; actual behaviour should now be the expected behaviour. |
Expected behavior
The shared library should link without error.
Actual behavior
For the following program named
err.cpp
:Compile and link it with:
There are linking errors:
Steps to reproduce the behavior
Compile rocksdb's shared library (version 5.18.4, though I think many versions have this issue) with
-march=armv8-a+crc+nocrypto
compile option and follow the steps in the 'Actual behavior' section.What's more, the default
make shared_lib
seems to detect CPU flags wrongly, for a+crc+nocrypto
CPU, it produces+crc+crypto
options, and lead to SIGILL.The text was updated successfully, but these errors were encountered: