Riscv has different abi variants which pass floating point arguments differently. This is controlled independently of the used target features and the linker checks that object files with different abi variants are not linked together. Currently Cranelift doesn't handle this at all and effectively uses the double float abi unconditionally. We will need a way to specify the float abi (soft, single, double), use this float abi even if the target features would allow the double float abi and expose a way for cranelift-object to get the chosen float abi to put in the e_flags field of an elf binary.

0
     WasmtimeAppleAarch64,
+    /// SystemV riscv have different ABI variants.
+    SystemVRiscv(SystemVRiscv),
+}
+
+pub struct SystemVRiscv {
+    float_call_conv: RiscvFloatCallConv,
+}
+
+pub enum RiscvFloatCallConv {
+    Soft,
+    Single,
+    Double,
+    Quad,
 }
 

@bjorn3 looks fine???

0

That should work I think. I do think there is still a need for an isa flag to specify which float call conv should be returned by the default_call_conv field.

0

I do think there is still a need for an isa flag to specify which float call conv should be returned by the default_call_conv field.

I am not understand this. I didn't see any connection between isa flags and default_call_conv.

0

The TargetIsa has a frontend_config method, which returns a value with the default_call_conv field. To make this method return the right value in the default_call_conv field, there has to be an isa flag to choose it.

0

@bjorn3 Sorry, I must missed that, I have add the setting.

0
  Running tests/filetests.rs (/home/yuyang/projects/wasmtime/target/riscv64gc-unknown-linux-gnu/debug/deps/filetests-ac71876a5d2b4558)
thread 'worker #7' panicked at 'not implemented: ISA flag float_abi of kind Enum', cranelift/filetests/src/test_run.rs:117:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'worker #8' panicked at 'not implemented: ISA flag float_abi of kind Enum', cranelift/filetests/src/test_run.rs:117:13
thread 'worker #6' panicked at 'not implemented: ISA flag float_abi of kind Enum', cranelift/filetests/src/test_run.rs:117:13
thread 'worker #9' panicked at 'not implemented: ISA flag float_abi of kind Enum', cranelift/filetests/src/test_run.rs:117:13
thread 'worker #6' panicked at 'not implemented: ISA flag float_abi of kind Enum', cranelift/filetests/src/test_run.rs:117:13
thread 'worker #7' panicked at 'not implemented: ISA flag float_abi of kind Enum', cranelift/filetests/src/test_run.rs:117:13
thread 'worker #6' panicked at 'not implemented: ISA flag float_abi of kind Enum', cranelift/filetests/src/test_run.rs:117:13
thread 'worker #8' panicked at 'not implemented: ISA flag float_abi of kind Enum', cranelift/filetests/src/test_run.rs:117:13
thread 'worker #7' panicked at 'not implemented: ISA flag float_abi of kind Enum', cranelift/filetests/src/test_run.rs:

I am getting this error.

0

Not sure how to deal with that.

0

This is indeed unimplemented.:-)

0

The runtest suite tries to check if the hardware supports the flags that were requested for this test.

This is done so that if a particular test tries to compile the code with has_avx512 and the host machine does not support avx512 we don't try to run the code and cause an illegal instruction error.

Currently that code only supports boolean values, I don't mind extending it to also support enums, ~but that would also mean that we have to choose some variant of the riscv float abi to be the one that is detected by cranelift-native and tests would only be able to use that one in particular or they would be skipped.~

~That variant also has to be the default one, or we skip all riscv tests.~

Edit: I think there is probably a better way to do this, but for now allowing all float_abi's seems okay

0
© 2022 pullanswer.com - All rights reserved.