Skip to content

Commit b99c661

Browse files
authored
Use cc_builder for riscv64gc-unknown-linux-gnu (#774)
* Use cc_builder for riscv64gc-unknown-linux-gnu This patch introduces support for building riscv64gc-unknown-linux-gnu target with cc_builder, which no longer requires extra cmake dependency. This patch also updates the CI to generate the sources list for riscv64. Close #735 * Drop clang-10 install for riscv64 It appears the CI already installs clang 14. * Drop extra quotes in AWS_LC_SYS_CFLAGS
1 parent b9e3b03 commit b99c661

File tree

6 files changed

+268
-3
lines changed

6 files changed

+268
-3
lines changed

.github/workflows/cross.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
6868
- if: ${{ matrix.target[0] == 'riscv64gc-unknown-linux-gnu' }}
6969
run: |
70-
echo 'AWS_LC_SYS_CFLAGS="-Wno-string-compare"' >> "$GITHUB_ENV"
70+
echo 'AWS_LC_SYS_CFLAGS=-Wno-string-compare' >> "$GITHUB_ENV"
7171
- if: ${{ !startsWith(matrix.target[0], 'x86_64') }}
7272
run: |
7373
echo 'AWS_LC_RS_DISABLE_SLOW_TESTS=1' >> "$GITHUB_ENV"

.github/workflows/sys-bindings-generator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ jobs:
267267
strategy:
268268
fail-fast: false
269269
matrix:
270-
target: [ aarch64-unknown-linux-gnu, i686-unknown-linux-gnu, aarch64-unknown-linux-musl, x86_64-unknown-linux-musl ]
270+
target: [ aarch64-unknown-linux-gnu, i686-unknown-linux-gnu, aarch64-unknown-linux-musl, riscv64gc-unknown-linux-gnu, x86_64-unknown-linux-musl ]
271271
steps:
272272
- uses: actions/checkout@v4
273273
with:

aws-lc-sys/builder/cc_builder.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ mod aarch64_apple_darwin;
99
mod aarch64_unknown_linux_gnu;
1010
mod aarch64_unknown_linux_musl;
1111
mod i686_unknown_linux_gnu;
12+
mod riscv64gc_unknown_linux_gnu;
1213
mod x86_64_apple_darwin;
1314
mod x86_64_unknown_linux_gnu;
1415
mod x86_64_unknown_linux_musl;
@@ -40,6 +41,7 @@ enum PlatformConfig {
4041
aarch64_apple_darwin,
4142
aarch64_unknown_linux_gnu,
4243
aarch64_unknown_linux_musl,
44+
riscv64gc_unknown_linux_gnu,
4345
x86_64_apple_darwin,
4446
x86_64_unknown_linux_gnu,
4547
x86_64_unknown_linux_musl,
@@ -54,6 +56,9 @@ impl PlatformConfig {
5456
PlatformConfig::aarch64_unknown_linux_musl => {
5557
aarch64_unknown_linux_musl::CRYPTO_LIBRARY
5658
}
59+
PlatformConfig::riscv64gc_unknown_linux_gnu => {
60+
riscv64gc_unknown_linux_gnu::CRYPTO_LIBRARY
61+
}
5762
PlatformConfig::x86_64_apple_darwin => x86_64_apple_darwin::CRYPTO_LIBRARY,
5863
PlatformConfig::x86_64_unknown_linux_gnu => x86_64_unknown_linux_gnu::CRYPTO_LIBRARY,
5964
PlatformConfig::x86_64_unknown_linux_musl => x86_64_unknown_linux_musl::CRYPTO_LIBRARY,
@@ -67,6 +72,7 @@ impl PlatformConfig {
6772
"aarch64-apple-darwin" => Some(PlatformConfig::aarch64_apple_darwin),
6873
"aarch64-unknown-linux-gnu" => Some(PlatformConfig::aarch64_unknown_linux_gnu),
6974
"aarch64-unknown-linux-musl" => Some(PlatformConfig::aarch64_unknown_linux_musl),
75+
"riscv64gc-unknown-linux-gnu" => Some(PlatformConfig::riscv64gc_unknown_linux_gnu),
7076
"x86_64-apple-darwin" => Some(PlatformConfig::x86_64_apple_darwin),
7177
"x86_64-unknown-linux-gnu" => Some(PlatformConfig::x86_64_unknown_linux_gnu),
7278
"x86_64-unknown-linux-musl" => Some(PlatformConfig::x86_64_unknown_linux_musl),
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR ISC
3+
// Thu 10 Apr 2025 01:06:21 PM UTC
4+
5+
use crate::cc_builder::Library;
6+
7+
pub(super) const CRYPTO_LIBRARY: Library = Library {
8+
name: "crypto",
9+
// This attribute is intentionally let blank
10+
flags: &[],
11+
sources: &[
12+
"crypto/asn1/a_bitstr.c",
13+
"crypto/asn1/a_bool.c",
14+
"crypto/asn1/a_d2i_fp.c",
15+
"crypto/asn1/a_dup.c",
16+
"crypto/asn1/a_gentm.c",
17+
"crypto/asn1/a_i2d_fp.c",
18+
"crypto/asn1/a_int.c",
19+
"crypto/asn1/a_mbstr.c",
20+
"crypto/asn1/a_object.c",
21+
"crypto/asn1/a_octet.c",
22+
"crypto/asn1/asn1_lib.c",
23+
"crypto/asn1/asn1_par.c",
24+
"crypto/asn1/asn_pack.c",
25+
"crypto/asn1/a_strex.c",
26+
"crypto/asn1/a_strnid.c",
27+
"crypto/asn1/a_time.c",
28+
"crypto/asn1/a_type.c",
29+
"crypto/asn1/a_utctm.c",
30+
"crypto/asn1/a_utf8.c",
31+
"crypto/asn1/f_int.c",
32+
"crypto/asn1/f_string.c",
33+
"crypto/asn1/posix_time.c",
34+
"crypto/asn1/tasn_dec.c",
35+
"crypto/asn1/tasn_enc.c",
36+
"crypto/asn1/tasn_fre.c",
37+
"crypto/asn1/tasn_new.c",
38+
"crypto/asn1/tasn_typ.c",
39+
"crypto/asn1/tasn_utl.c",
40+
"crypto/base64/base64.c",
41+
"crypto/bio/bio.c",
42+
"crypto/bio/bio_mem.c",
43+
"crypto/bio/connect.c",
44+
"crypto/bio/errno.c",
45+
"crypto/bio/fd.c",
46+
"crypto/bio/file.c",
47+
"crypto/bio/hexdump.c",
48+
"crypto/bio/pair.c",
49+
"crypto/bio/printf.c",
50+
"crypto/bio/socket.c",
51+
"crypto/bio/socket_helper.c",
52+
"crypto/blake2/blake2.c",
53+
"crypto/bn_extra/bn_asn1.c",
54+
"crypto/bn_extra/convert.c",
55+
"crypto/buf/buf.c",
56+
"crypto/bytestring/asn1_compat.c",
57+
"crypto/bytestring/ber.c",
58+
"crypto/bytestring/cbb.c",
59+
"crypto/bytestring/cbs.c",
60+
"crypto/bytestring/unicode.c",
61+
"crypto/chacha/chacha.c",
62+
"crypto/cipher_extra/cipher_extra.c",
63+
"crypto/cipher_extra/derive_key.c",
64+
"crypto/cipher_extra/e_aes_cbc_hmac_sha1.c",
65+
"crypto/cipher_extra/e_aes_cbc_hmac_sha256.c",
66+
"crypto/cipher_extra/e_aesctrhmac.c",
67+
"crypto/cipher_extra/e_aesgcmsiv.c",
68+
"crypto/cipher_extra/e_chacha20poly1305.c",
69+
"crypto/cipher_extra/e_des.c",
70+
"crypto/cipher_extra/e_null.c",
71+
"crypto/cipher_extra/e_rc2.c",
72+
"crypto/cipher_extra/e_rc4.c",
73+
"crypto/cipher_extra/e_tls.c",
74+
"crypto/cipher_extra/tls_cbc.c",
75+
"crypto/conf/conf.c",
76+
"crypto/crypto.c",
77+
"crypto/decrepit/bio/base64_bio.c",
78+
"crypto/decrepit/blowfish/blowfish.c",
79+
"crypto/decrepit/cast/cast.c",
80+
"crypto/decrepit/cast/cast_tables.c",
81+
"crypto/decrepit/cfb/cfb.c",
82+
"crypto/decrepit/dh/dh_decrepit.c",
83+
"crypto/decrepit/evp/evp_do_all.c",
84+
"crypto/decrepit/obj/obj_decrepit.c",
85+
"crypto/decrepit/ripemd/ripemd.c",
86+
"crypto/decrepit/rsa/rsa_decrepit.c",
87+
"crypto/decrepit/x509/x509_decrepit.c",
88+
"crypto/des/des.c",
89+
"crypto/dh_extra/dh_asn1.c",
90+
"crypto/dh_extra/params.c",
91+
"crypto/digest_extra/digest_extra.c",
92+
"crypto/dsa/dsa_asn1.c",
93+
"crypto/dsa/dsa.c",
94+
"crypto/ecdh_extra/ecdh_extra.c",
95+
"crypto/ecdsa_extra/ecdsa_asn1.c",
96+
"crypto/ec_extra/ec_asn1.c",
97+
"crypto/ec_extra/ec_derive.c",
98+
"crypto/ec_extra/hash_to_curve.c",
99+
"crypto/engine/engine.c",
100+
"crypto/err/err.c",
101+
"crypto/evp_extra/evp_asn1.c",
102+
"crypto/evp_extra/p_dh_asn1.c",
103+
"crypto/evp_extra/p_dh.c",
104+
"crypto/evp_extra/p_dsa_asn1.c",
105+
"crypto/evp_extra/p_dsa.c",
106+
"crypto/evp_extra/p_ec_asn1.c",
107+
"crypto/evp_extra/p_ed25519_asn1.c",
108+
"crypto/evp_extra/p_hmac_asn1.c",
109+
"crypto/evp_extra/p_kem_asn1.c",
110+
"crypto/evp_extra/p_methods.c",
111+
"crypto/evp_extra/p_pqdsa_asn1.c",
112+
"crypto/evp_extra/print.c",
113+
"crypto/evp_extra/p_rsa_asn1.c",
114+
"crypto/evp_extra/p_x25519_asn1.c",
115+
"crypto/evp_extra/p_x25519.c",
116+
"crypto/evp_extra/scrypt.c",
117+
"crypto/evp_extra/sign.c",
118+
"crypto/ex_data.c",
119+
"crypto/fipsmodule/bcm.c",
120+
"crypto/fipsmodule/cpucap/cpucap.c",
121+
"crypto/fipsmodule/fips_shared_support.c",
122+
"crypto/hpke/hpke.c",
123+
"crypto/hrss/hrss.c",
124+
"crypto/kyber/kem_kyber.c",
125+
"crypto/kyber/kyber1024r3_ref.c",
126+
"crypto/kyber/kyber512r3_ref.c",
127+
"crypto/kyber/kyber768r3_ref.c",
128+
"crypto/kyber/pqcrystals_kyber_ref_common/fips202.c",
129+
"crypto/lhash/lhash.c",
130+
"crypto/mem.c",
131+
"crypto/obj/obj.c",
132+
"crypto/obj/obj_xref.c",
133+
"crypto/ocsp/ocsp_asn.c",
134+
"crypto/ocsp/ocsp_client.c",
135+
"crypto/ocsp/ocsp_extension.c",
136+
"crypto/ocsp/ocsp_http.c",
137+
"crypto/ocsp/ocsp_lib.c",
138+
"crypto/ocsp/ocsp_print.c",
139+
"crypto/ocsp/ocsp_server.c",
140+
"crypto/ocsp/ocsp_verify.c",
141+
"crypto/pem/pem_all.c",
142+
"crypto/pem/pem_info.c",
143+
"crypto/pem/pem_lib.c",
144+
"crypto/pem/pem_oth.c",
145+
"crypto/pem/pem_pk8.c",
146+
"crypto/pem/pem_pkey.c",
147+
"crypto/pem/pem_x509.c",
148+
"crypto/pem/pem_xaux.c",
149+
"crypto/pkcs7/bio/cipher.c",
150+
"crypto/pkcs7/bio/md.c",
151+
"crypto/pkcs7/pkcs7_asn1.c",
152+
"crypto/pkcs7/pkcs7.c",
153+
"crypto/pkcs7/pkcs7_x509.c",
154+
"crypto/pkcs8/p5_pbev2.c",
155+
"crypto/pkcs8/pkcs8.c",
156+
"crypto/pkcs8/pkcs8_x509.c",
157+
"crypto/poly1305/poly1305_arm.c",
158+
"crypto/poly1305/poly1305.c",
159+
"crypto/poly1305/poly1305_vec.c",
160+
"crypto/pool/pool.c",
161+
"crypto/rand_extra/deterministic.c",
162+
"crypto/rand_extra/entropy_passive.c",
163+
"crypto/rand_extra/forkunsafe.c",
164+
"crypto/rand_extra/rand_extra.c",
165+
"crypto/rand_extra/windows.c",
166+
"crypto/rc4/rc4.c",
167+
"crypto/refcount_c11.c",
168+
"crypto/refcount_lock.c",
169+
"crypto/refcount_win.c",
170+
"crypto/rsa_extra/rsa_asn1.c",
171+
"crypto/rsa_extra/rsa_crypt.c",
172+
"crypto/rsa_extra/rsa_print.c",
173+
"crypto/rsa_extra/rsassa_pss_asn1.c",
174+
"crypto/siphash/siphash.c",
175+
"crypto/spake25519/spake25519.c",
176+
"crypto/stack/stack.c",
177+
"crypto/thread.c",
178+
"crypto/thread_none.c",
179+
"crypto/thread_pthread.c",
180+
"crypto/thread_win.c",
181+
"crypto/trust_token/pmbtoken.c",
182+
"crypto/trust_token/trust_token.c",
183+
"crypto/trust_token/voprf.c",
184+
"crypto/x509/a_digest.c",
185+
"crypto/x509/algorithm.c",
186+
"crypto/x509/a_sign.c",
187+
"crypto/x509/asn1_gen.c",
188+
"crypto/x509/a_verify.c",
189+
"crypto/x509/by_dir.c",
190+
"crypto/x509/by_file.c",
191+
"crypto/x509/i2d_pr.c",
192+
"crypto/x509/name_print.c",
193+
"crypto/x509/policy.c",
194+
"crypto/x509/rsa_pss.c",
195+
"crypto/x509/t_crl.c",
196+
"crypto/x509/t_req.c",
197+
"crypto/x509/t_x509a.c",
198+
"crypto/x509/t_x509.c",
199+
"crypto/x509/v3_akeya.c",
200+
"crypto/x509/v3_akey.c",
201+
"crypto/x509/v3_alt.c",
202+
"crypto/x509/v3_bcons.c",
203+
"crypto/x509/v3_bitst.c",
204+
"crypto/x509/v3_conf.c",
205+
"crypto/x509/v3_cpols.c",
206+
"crypto/x509/v3_crld.c",
207+
"crypto/x509/v3_enum.c",
208+
"crypto/x509/v3_extku.c",
209+
"crypto/x509/v3_genn.c",
210+
"crypto/x509/v3_ia5.c",
211+
"crypto/x509/v3_info.c",
212+
"crypto/x509/v3_int.c",
213+
"crypto/x509/v3_lib.c",
214+
"crypto/x509/v3_ncons.c",
215+
"crypto/x509/v3_ocsp.c",
216+
"crypto/x509/v3_pcons.c",
217+
"crypto/x509/v3_pmaps.c",
218+
"crypto/x509/v3_prn.c",
219+
"crypto/x509/v3_purp.c",
220+
"crypto/x509/v3_skey.c",
221+
"crypto/x509/v3_utl.c",
222+
"crypto/x509/x509_att.c",
223+
"crypto/x509/x509.c",
224+
"crypto/x509/x509_cmp.c",
225+
"crypto/x509/x509cset.c",
226+
"crypto/x509/x509_d2.c",
227+
"crypto/x509/x509_def.c",
228+
"crypto/x509/x509_ext.c",
229+
"crypto/x509/x509_lu.c",
230+
"crypto/x509/x509name.c",
231+
"crypto/x509/x509_obj.c",
232+
"crypto/x509/x509_req.c",
233+
"crypto/x509/x509rset.c",
234+
"crypto/x509/x509_set.c",
235+
"crypto/x509/x509spki.c",
236+
"crypto/x509/x509_trs.c",
237+
"crypto/x509/x509_txt.c",
238+
"crypto/x509/x509_v3.c",
239+
"crypto/x509/x509_vfy.c",
240+
"crypto/x509/x509_vpm.c",
241+
"crypto/x509/x_algor.c",
242+
"crypto/x509/x_all.c",
243+
"crypto/x509/x_attrib.c",
244+
"crypto/x509/x_crl.c",
245+
"crypto/x509/x_exten.c",
246+
"crypto/x509/x_name.c",
247+
"crypto/x509/x_pubkey.c",
248+
"crypto/x509/x_req.c",
249+
"crypto/x509/x_sig.c",
250+
"crypto/x509/x_spki.c",
251+
"crypto/x509/x_val.c",
252+
"crypto/x509/x_x509a.c",
253+
"crypto/x509/x_x509.c",
254+
"generated-src/err_data.c",
255+
],
256+
};

aws-lc-sys/builder/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ macro_rules! bindgen_available {
8888
)
8989
),
9090
all(target_arch = "x86", target_os = "windows", target_env = "msvc"),
91-
all(target_arch = "x86", target_os = "linux", target_env = "gnu")
91+
all(target_arch = "x86", target_os = "linux", target_env = "gnu"),
92+
all(target_arch = "riscv64", target_os = "linux", target_env = "gnu")
9293
))
9394
)))]
9495
$item

scripts/build/collect_build_src.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ function find_generated_src_dir() {
101101

102102
if [[ "${TARGET_PLATFORM_ARCH}" =~ "aarch64" ]]; then
103103
ARCH_NAME="aarch64"
104+
elif [[ "${TARGET_PLATFORM_ARCH}" =~ "riscv64" ]]; then
105+
ARCH_NAME="riscv64"
104106
elif [[ "${TARGET_PLATFORM_ARCH}" =~ "x86_64" ]]; then
105107
ARCH_NAME="x86_64"
106108
elif [[ "${TARGET_PLATFORM_ARCH}" =~ "i686" ]]; then

0 commit comments

Comments
 (0)