@@ -4,9 +4,22 @@ use fedimint_client_rpc::{RpcGlobalState, RpcRequest, RpcResponse, RpcResponseHa
44use fedimint_connectors:: ConnectorRegistry ;
55use fedimint_core:: db:: Database ;
66
7+ // Force the linker to pull in our strong sdallocx stub from sdallocx_stub.c.
8+ // On Android, aws-lc declares sdallocx as a weak symbol. The Android linker
9+ // resolves weak GLOB_DAT entries to the PLT stub (non-NULL) while JUMP_SLOT
10+ // stays 0 → SIGSEGV. Our stub provides a strong definition that delegates to free().
11+ #[ cfg( target_os = "android" ) ]
12+ extern "C" {
13+ fn sdallocx ( ptr : * mut std:: ffi:: c_void , size : usize , flags : i32 ) ;
14+ }
15+
16+ #[ cfg( target_os = "android" ) ]
17+ #[ used]
18+ static FORCE_SDALLOCX : unsafe extern "C" fn ( * mut std:: ffi:: c_void , usize , i32 ) = sdallocx;
19+
720uniffi:: setup_scaffolding!( ) ;
821
9- const DB_FILE_NAME : & str = "fedimint.redb " ;
22+ const DB_DIR_NAME : & str = "fedimint_db " ;
1023
1124#[ derive( Debug , thiserror:: Error , uniffi:: Error ) ]
1225pub enum FedimintError {
@@ -93,7 +106,7 @@ impl RpcResponseHandler for CallbackWrapper {
93106async fn create_database ( path : & str ) -> anyhow:: Result < Database > {
94107 tokio:: fs:: create_dir_all ( path) . await ?;
95108
96- let db_path = std:: path:: Path :: new ( path) . join ( DB_FILE_NAME ) ;
109+ let db_path = std:: path:: Path :: new ( path) . join ( DB_DIR_NAME ) ;
97110 let db = fedimint_rocksdb:: RocksDb :: build ( db_path) . open ( ) . await ?;
98111
99112 Ok ( Database :: new ( db, Default :: default ( ) ) )
0 commit comments