@@ -9,6 +9,7 @@ use crate::shims::alloc::EvalContextExt as _;
9
9
use crate :: shims:: unix:: * ;
10
10
use crate :: * ;
11
11
12
+ use shims:: unix:: android:: foreign_items as android;
12
13
use shims:: unix:: freebsd:: foreign_items as freebsd;
13
14
use shims:: unix:: linux:: foreign_items as linux;
14
15
use shims:: unix:: macos:: foreign_items as macos;
@@ -26,6 +27,7 @@ pub fn is_dyn_sym(name: &str, target_os: &str) -> bool {
26
27
// Give specific OSes a chance to allow their symbols.
27
28
_ =>
28
29
match target_os {
30
+ "android" => android:: is_dyn_sym ( name) ,
29
31
"freebsd" => freebsd:: is_dyn_sym ( name) ,
30
32
"linux" => linux:: is_dyn_sym ( name) ,
31
33
"macos" => macos:: is_dyn_sym ( name) ,
@@ -267,7 +269,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
267
269
268
270
"reallocarray" => {
269
271
// Currently this function does not exist on all Unixes, e.g. on macOS.
270
- if !matches ! ( & * this. tcx. sess. target. os, "linux" | "freebsd" ) {
272
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "freebsd" | "android" ) {
271
273
throw_unsup_format ! (
272
274
"`reallocarray` is not supported on {}" ,
273
275
this. tcx. sess. target. os
@@ -585,7 +587,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
585
587
"getentropy" => {
586
588
// This function is non-standard but exists with the same signature and behavior on
587
589
// Linux, macOS, FreeBSD and Solaris/Illumos.
588
- if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" | "freebsd" | "illumos" | "solaris" ) {
590
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "macos" | "freebsd" | "illumos" | "solaris" | "android" ) {
589
591
throw_unsup_format ! (
590
592
"`getentropy` is not supported on {}" ,
591
593
this. tcx. sess. target. os
@@ -614,9 +616,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
614
616
"getrandom" => {
615
617
// This function is non-standard but exists with the same signature and behavior on
616
618
// Linux, FreeBSD and Solaris/Illumos.
617
- if !matches ! ( & * this. tcx. sess. target. os, "linux" | "freebsd" | "illumos" | "solaris" ) {
619
+ if !matches ! ( & * this. tcx. sess. target. os, "linux" | "freebsd" | "illumos" | "solaris" | "android" ) {
618
620
throw_unsup_format ! (
619
- "`getentropy ` is not supported on {}" ,
621
+ "`getrandom ` is not supported on {}" ,
620
622
this. tcx. sess. target. os
621
623
) ;
622
624
}
@@ -740,6 +742,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
740
742
_ => {
741
743
let target_os = & * this. tcx . sess . target . os ;
742
744
return match target_os {
745
+ "android" => android:: EvalContextExt :: emulate_foreign_item_inner ( this, link_name, abi, args, dest) ,
743
746
"freebsd" => freebsd:: EvalContextExt :: emulate_foreign_item_inner ( this, link_name, abi, args, dest) ,
744
747
"linux" => linux:: EvalContextExt :: emulate_foreign_item_inner ( this, link_name, abi, args, dest) ,
745
748
"macos" => macos:: EvalContextExt :: emulate_foreign_item_inner ( this, link_name, abi, args, dest) ,
0 commit comments