使用方式
在CPU构架为arrch64(arm64)的系统下静态链接libcrypto.a 与libssl.a
错误
……Linux/aarch64/libcrypto.a(sha1-armv8.o): relocation R_AARCH64_PREL64 against symbol `OPENSSL_armcap_P' which may bind externally can not be used when making a shared object; recompile with -fPIC
……Linux/aarch64/libcrypto.a(sha1-armv8.o): in function `sha1_block_armv8':
(.text+0x1240): dangerous relocation: 不支持的重定位
……Linux/aarch64/libcrypto.a(chacha-armv8.o): relocation R_AARCH64_PREL64 against symbol `OPENSSL_armcap_P' which may bind externally can not be used when making a shared object; recompile with -fPIC
……Linux/aarch64/libcrypto.a(chacha-armv8.o):(.text+0x20): dangerous relocation: 不支持的重定位
……Linux/aarch64/libcrypto.a(poly1305-armv8.o): relocation R_AARCH64_ADR_PREL_LO21 against symbol `poly1305_blocks' which may bind externally can not be used when making a shared object; recompile with -fPIC
……Linux/aarch64/libcrypto.a(poly1305-armv8.o): in function `poly1305_init':
(.text+0x40): dangerous relocation: 不支持的重定位
……Linux/aarch64/libcrypto.a(poly1305-armv8.o): relocation R_AARCH64_ADR_PREL_LO21 against symbol `poly1305_emit' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: (.text+0x48): dangerous relocation: 不支持的重定位
……Linux/aarch64/libcrypto.a(poly1305-armv8.o): relocation R_AARCH64_PREL64 against symbol `OPENSSL_armcap_P' which may bind externally can not be used when making a shared object; recompile with -fPIC
……Linux/aarch64/libcrypto.a(poly1305-armv8.o): in function `poly1305_emit_neon':
(.text+0x9a0): dangerous relocation: 不支持的重定位
……Linux/aarch64/libcrypto.a(sha256-armv8.o): relocation R_AARCH64_PREL64 against symbol `OPENSSL_armcap_P' which may bind externally can not be used when making a shared object; recompile with -fPIC
……Linux/aarch64/libcrypto.a(sha256-armv8.o): in function `sha256_block_data_order':
(.text+0xf88): dangerous relocation: 不支持的重定位
……Linux/aarch64/libcrypto.a(sha512-armv8.o): relocation R_AARCH64_PREL64 against symbol `OPENSSL_armcap_P' which may bind externally can not be used when making a shared object; recompile with -fPIC
……Linux/aarch64/libcrypto.a(sha512-armv8.o): in function `sha512_block_data_order':
(.text+0x1108): dangerous relocation: 不支持的重定位
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/NetSealClientCNG.dir/build.make:474:bin/lib/libNetSealClientCNG.so] 错误 1
make[1]: *** [CMakeFiles/Makefile2:91:src/CMakeFiles/NetSealClientCNG.dir/all] 错误 2
make: *** [Makefile:84:all] 错误 2
解决方案
方法来源:
https://github.com/openssl/openssl/compare/OpenSSL_1_1_1-stable%E2%80%A6Romain-Geissler-1A:OpenSSL_1_1_1-stable
方法:(+ 为加入 - 为删除)
openssl源码 crypto/chacha/asm/chacha-armv8.pl
125 .text
126
127 .extern OPENSSL_armcap_P
+ .hidden OPENSSL_armcap_P
128 .align 5
129 .Lsigma:
openssl源码 crypto/poly1305/asm/poly1305-armv8.pl
58 // forward "declarations" are required for Apple
59 .extern OPENSSL_armcap_P
+ .hidden OPENSSL_armcap_P
+ .globl poly1305_init
+ .hidden poly1305_init
60 .globl poly1305_blocks
+ .hidden poly1305_blocks
61.globl poly1305_emit
+ .hidden poly1305_emit
62
- .globl poly1305_init
64 .type poly1305_init,%function
64 .align 5
poly1305_init:
openssl源码 crypto/sha/asm/sha1-armv8.pl
176 .text
177
178 .extern OPENSSL_armcap_P
+ .hidden OPENSSL_armcap_P
179 .globl sha1_block_data_order
180 .type sha1_block_data_order,%function
181 .align 6
330
331 .asciz "SHA1 block transform for ARMv8, CRYPTOGAMS by <appro\@openssl.org>"
332 .align 2
- .comm OPENSSL_armcap_P,4,4
333 ___
334 }}}
openssl源码 crypto/sha/asm/sha512-armv8.pl
193 .text
194
195 .extern OPENSSL_armcap_P
+ .hidden OPENSSL_armcap_P
197 .globl $func
198 .type $func,%function
199 .align 6
841 ___
842 }
843
- $code.=<<___;
-
- .comm OPENSSL_armcap_P,4,4
-
- ___
-
849 { my %opcode = (
|