FractalFir / rustc_codegen_clr

This rust compiler backend(module) emmits valid CIL (.NET IR), enabling you to use Rust in .NET projects.
MIT License
1.51k stars 35 forks source link

Test assemblies are invalid when loading with dotPeek #18

Closed karashiiro closed 1 year ago

karashiiro commented 1 year ago

The assembly output for test_lib tests seems to be invalid, and cannot be loaded with dotPeek to view their IL. The run_test executables seem to work fine.

As a comparison, this is what shows up when loading add.exe: image

And this is what shows up when loading binops.dll: image

I think this has been happening ever since the linker changes about a week ago.

FractalFir commented 1 year ago

I think I caught the source of the bug: the linker does not yet differentiate between static libraries and executables.

FractalFir commented 1 year ago

The test_libs seem to not build at all, but the output of rustc is empty. The assembly that you can't open is likely an old one.

FractalFir commented 1 year ago

UPDATE: the issue with assemblies not being built is a separate one, and it got fixed. It seems like the codegen saves .rlib files as .dll

FractalFir commented 1 year ago

Fixed in 26f6a20b18f1f81a75db56383479429d78d8b0e7. The root cause of the bugs was .rlib files being saved as .dll, and the linker not being invoked by the test runner.

karashiiro commented 1 year ago

Confirmed working now, thanks!