mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-24 09:19:25 +00:00
Finish emitting and loading the trampoline code.
Turning an LLVM module into a CompiledFunction should be refactored. Bump to latest inkwell so that we can make use of object_file with the fixes. Comment out accidentally committed debug code that writes to my home directory.
This commit is contained in:
@ -277,12 +277,14 @@ impl FuncTranslator {
|
||||
.write_to_memory_buffer(&mut module, FileType::Object)
|
||||
.unwrap();
|
||||
|
||||
/*
|
||||
let mem_buf_slice = memory_buffer.as_slice();
|
||||
let mut file = fs::File::create("/home/nicholas/x.o").unwrap();
|
||||
let mut pos = 0;
|
||||
while pos < mem_buf_slice.len() {
|
||||
pos += file.write(&mem_buf_slice[pos..]).unwrap();
|
||||
}
|
||||
*/
|
||||
|
||||
let object = memory_buffer.create_object_file().map_err(|()| {
|
||||
CompileError::Codegen("failed to create object file from llvm ir".to_string())
|
||||
@ -290,7 +292,9 @@ impl FuncTranslator {
|
||||
|
||||
let mut bytes = vec![];
|
||||
for section in object.get_sections() {
|
||||
if section.get_name().to_bytes() == "wasmer_function".as_bytes() {
|
||||
if section.get_name().map(std::ffi::CStr::to_bytes)
|
||||
== Some("wasmer_function".as_bytes())
|
||||
{
|
||||
bytes.extend(section.get_contents().to_bytes());
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user