rust-lang / rustc_codegen_gcc

libgccjit AOT codegen for rustc
Apache License 2.0
893 stars 61 forks source link

Remove the builtin import code #513

Open antoyo opened 2 months ago

antoyo commented 2 months ago

The builtin import code is a hack and it's starting to be an issue. With the more recent compiler_builtins which implements the math builtin functions in Rust, we can get conflicts between the GCC imported builtins and the Rust builtins:

libgccjit.so: error: : gcc_jit_function_new_block: cannot add block to an imported function
thread 'rustc' panicked at /home/user/.cargo/git/checkouts/gccjit.rs-13c2e290f2fb9e4d/f1545d7/src/function.rs:183:17:
gcc_jit_function_new_block: cannot add block to an imported function (cos)
g4titanx commented 1 month ago

if it's not being used anywhere else in the code, it shouldn't be a problem

antoyo commented 1 month ago

Well, it's used in the sense that it's how we are able to return the Function object for builtin functions when requested elsewhere. But having to list them all is not a good solution: I'd prefer something that would fetch the builtin only when requested. Feel free to ask for more info in that's not clear.