Merge pull request #506 from nicholasbishop/bishop-fix-stdlib-inc
This commit is contained in:
commit
96bfaa2e09
1 changed files with 16 additions and 1 deletions
|
|
@ -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"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue