gen_dev: generate and link zig builtins.

This commit is contained in:
Brendan Hansknecht 2021-02-14 18:15:00 -08:00
parent 6293fbfade
commit 7d24d51392
10 changed files with 322 additions and 95 deletions

View file

@ -2,15 +2,20 @@ use std::fs::File;
use std::io::prelude::Read;
use std::vec::Vec;
const PATH: &str = env!(
const BC_PATH: &str = env!(
"BUILTINS_BC",
"Env var BUILTINS_BC not found. Is there a problem with the build script?"
);
pub const OBJ_PATH: &str = env!(
"BUILTINS_O",
"Env var BUILTINS_O not found. Is there a problem with the build script?"
);
pub fn get_bytes() -> Vec<u8> {
// In the build script for the builtins module, we compile the builtins bitcode and set
// BUILTINS_BC to the path to the compiled output.
let mut builtins_bitcode = File::open(PATH).expect("Unable to find builtins bitcode source");
let mut builtins_bitcode = File::open(BC_PATH).expect("Unable to find builtins bitcode source");
let mut buffer = Vec::new();
builtins_bitcode
.read_to_end(&mut buffer)