summaryrefslogtreecommitdiffstats
path: root/vendor/compiler_builtins/build.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
commit4547b622d8d29df964fa2914213088b148c498fc (patch)
tree9fc6b25f3c3add6b745be9a2400a6e96140046e9 /vendor/compiler_builtins/build.rs
parentReleasing progress-linux version 1.66.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-4547b622d8d29df964fa2914213088b148c498fc.tar.xz
rustc-4547b622d8d29df964fa2914213088b148c498fc.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/compiler_builtins/build.rs')
-rw-r--r--vendor/compiler_builtins/build.rs20
1 files changed, 18 insertions, 2 deletions
diff --git a/vendor/compiler_builtins/build.rs b/vendor/compiler_builtins/build.rs
index 73952bb9f..3f5dbd3ab 100644
--- a/vendor/compiler_builtins/build.rs
+++ b/vendor/compiler_builtins/build.rs
@@ -98,7 +98,7 @@ mod c {
use std::collections::{BTreeMap, HashSet};
use std::env;
- use std::fs::File;
+ use std::fs::{self, File};
use std::io::Write;
use std::path::{Path, PathBuf};
@@ -190,6 +190,21 @@ mod c {
cfg.define("VISIBILITY_HIDDEN", None);
}
+ // int_util.c tries to include stdlib.h if `_WIN32` is defined,
+ // which it is when compiling UEFI targets with clang. This is
+ // at odds with compiling with `-ffreestanding`, as the header
+ // may be incompatible or not present. Create a minimal stub
+ // header to use instead.
+ if target_os == "uefi" {
+ let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
+ let include_dir = out_dir.join("include");
+ if !include_dir.exists() {
+ fs::create_dir(&include_dir).unwrap();
+ }
+ fs::write(include_dir.join("stdlib.h"), "#include <stddef.h>").unwrap();
+ cfg.flag(&format!("-I{}", include_dir.to_str().unwrap()));
+ }
+
let mut sources = Sources::new();
sources.extend(&[
("__absvdi2", "absvdi2.c"),
@@ -465,7 +480,8 @@ mod c {
}
// Remove the assembly implementations that won't compile for the target
- if llvm_target[0] == "thumbv6m" || llvm_target[0] == "thumbv8m.base" {
+ if llvm_target[0] == "thumbv6m" || llvm_target[0] == "thumbv8m.base" || target_os == "uefi"
+ {
let mut to_remove = Vec::new();
for (k, v) in sources.map.iter() {
if v.ends_with(".S") {