diff --git a/build.rs b/build.rs index 73952bb9f..a425e3e13 100644 --- a/build.rs +++ b/build.rs @@ -201,7 +201,6 @@ mod c { ("__cmpdi2", "cmpdi2.c"), ("__ctzdi2", "ctzdi2.c"), ("__ctzsi2", "ctzsi2.c"), - ("__int_util", "int_util.c"), ("__mulvdi3", "mulvdi3.c"), ("__mulvsi3", "mulvsi3.c"), ("__negdi2", "negdi2.c"), @@ -216,6 +215,15 @@ mod c { ("__ucmpdi2", "ucmpdi2.c"), ]); + // UEFI is treated as a windows target when compiling with + // clang, and int_util.c includes stdlib.h for windows targets + // even though we are compiling with `-ffreestanding`. That + // header may not be present might be incompatible, so skip this + // file on UEFI targets. + if target_os != "uefi" { + sources.extend(&[("__int_util", "int_util.c")]); + } + if consider_float_intrinsics { sources.extend(&[ ("__divdc3", "divdc3.c"),