Skip to content

Commit 2cee70f

Browse files
committed
Add missing riscv openssl build parameter
1 parent 21bf1a6 commit 2cee70f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

build_support/static_build.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,21 @@ def _build_openssl(self, env, prefix_arg, cross_compile):
288288
self.info('Building OpenSSL')
289289
openssl_dir = next(self.build_libs_dir.glob('openssl-*'))
290290
openssl_config_cmd = [prefix_arg, 'no-shared', '-fPIC', '--libdir=lib']
291+
if platform.machine() == 'riscv64':
292+
# openssl(riscv64): disable ASM to avoid R_RISCV_JAL relocation failure on 3.5.2
293+
# OpenSSL 3.5.2 enables RISC-V64 AES assembly by default. When we statically
294+
# link libcrypto alongside xmlsec, the AES asm path triggers a link-time error:
295+
# relocation truncated to fit: R_RISCV_JAL against symbol `AES_set_encrypt_key'
296+
# in .../libcrypto.a(libcrypto-lib-aes-riscv64.o)
297+
# This appears to stem from a long-range jump emitted by the AES asm generator
298+
# (see aes-riscv64.pl around L1069), which can exceed the JAL reach when objects
299+
# end up far apart in the final static link.
300+
# As a pragmatic workaround, disable ASM on riscv64 (pass `no-asm`) so the
301+
# portable C implementation is used. This unblocks the build at the cost of
302+
# some crypto performance on riscv64 only.
303+
# Refs:
304+
# - https://github.com/openssl/openssl/blob/0893a62/crypto/aes/asm/aes-riscv64.pl#L1069
305+
openssl_config_cmd.append('no-asm')
291306
if cross_compile:
292307
openssl_config_cmd.insert(0, './Configure')
293308
openssl_config_cmd.append(cross_compile.triplet)

0 commit comments

Comments
 (0)