Skip to content

Commit

Permalink
fix llvm and removed unused dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
shiinamiyuki committed Nov 26, 2023
1 parent 36422ac commit cd52b03
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 34 deletions.
10 changes: 1 addition & 9 deletions luisa_compute_sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
luisa_compute_api_types = {path = "LuisaCompute/src/rust/luisa_compute_api_types"}
luisa_compute_backend = {path = "LuisaCompute/src/rust/luisa_compute_backend"}
luisa_compute_ir = {path = "../luisa_compute_sys/LuisaCompute/src/rust/luisa_compute_ir"}
libc = "0.2"
lazy_static = "1.4"
parking_lot = "0.12.1"


[build-dependencies]
cmake = "0.1.48"
Expand All @@ -27,6 +22,3 @@ metal = []
dx = []
oidn = []


[lib]
crate-type = ["dylib"]
2 changes: 1 addition & 1 deletion luisa_compute_sys/LuisaCompute
11 changes: 11 additions & 0 deletions luisa_compute_sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,15 @@ fn copy_dlls(out_dir: &PathBuf) {
fn main() {
let out_dir = cmake_build();
copy_dlls(&out_dir);

#[cfg(target_os = "linux")]
{
println!("rerun-if-changed=./llvm_dummy_orc");
let out = cmake::Config::new("./llvm_dummy_orc")
.build_target("dummy_orc_eh")
.build();
dbg!(&out);
println!("cargo:rustc-link-lib=dylib=dummy_orc_eh");
println!("cargo:rustc-link-search=native={}/build", out.display());
}
}
4 changes: 4 additions & 0 deletions luisa_compute_sys/llvm_hack/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.15)
project(dummy_orc_eh)

add_library(dummy_orc_eh SHARED dummy_orc_eh.cc)
32 changes: 32 additions & 0 deletions luisa_compute_sys/llvm_hack/dummy_orc_eh.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <cstddef>
namespace dummy_orc_eh
{
union CWrapperFunctionResultDataUnion
{
char *ValuePtr;
char Value[sizeof(ValuePtr)];
};

typedef struct
{
CWrapperFunctionResultDataUnion Data;
size_t Size;
} CWrapperFunctionResult;
extern "C"
{
CWrapperFunctionResult llvm_orc_registerEHFrameSectionWrapper(const char *Data, size_t Size)
{
CWrapperFunctionResult r;
r.Data.ValuePtr = nullptr;
r.Size = 0;
return r;
}
CWrapperFunctionResult llvm_orc_deregisterEHFrameSectionWrapper(const char *Data, size_t Size)
{
CWrapperFunctionResult r;
r.Data.ValuePtr = nullptr;
r.Size = 0;
return r;
}
}
}
28 changes: 4 additions & 24 deletions luisa_compute_sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{ffi::c_char, ptr::null};
use std::ffi::c_char;
// union CWrapperFunctionResultDataUnion {
// char *ValuePtr;
// char Value[sizeof(ValuePtr)];
Expand All @@ -21,28 +21,8 @@ pub struct CWrapperFunctionResult {
pub Size: usize,
}

#[no_mangle]
#[inline(never)]
pub unsafe extern "C" fn llvm_orc_registerEHFrameSectionWrapper(
_data: *const c_char,
_size: u64,
) -> CWrapperFunctionResult {
let result = CWrapperFunctionResult {
Data: CWrapperFunctionResultDataUnion { ValuePtr: null() },
Size: 0,
};
result
}
extern "C" {
pub fn llvm_orc_registerEHFrameSectionWrapper(_data: *const c_char, _size: u64);

#[no_mangle]
#[inline(never)]
pub unsafe extern "C" fn llvm_orc_deregisterEHFrameSectionWrapper(
_data: *const c_char,
_size: u64,
) -> CWrapperFunctionResult {
let result = CWrapperFunctionResult {
Data: CWrapperFunctionResultDataUnion { ValuePtr: null() },
Size: 0,
};
result
pub fn llvm_orc_deregisterEHFrameSectionWrapper(_data: *const c_char, _size: u64);
}

0 comments on commit cd52b03

Please sign in to comment.