Open iarischenko opened 6 years ago
The root cause of the issue: jit placed double in R0, R1 registers
This would happen if you use armel
JIT to generate code for arm
. Could you please double check that you are running arm
JIT and not armel
JIT? I do not think we have any check in place to prevent mismatch like this. It may be worth it to put one in place.
. Could you please double check that you are running arm JIT and not armel JIT?
I have two environments, one for arm and one for armel (in docker, other machine). ilc.rsp file for arm starts with:
1 --targetarch=arm
2 /overlay.arm.Debug/test/test.dll
and ilc.rsp file for armel starts with:
1 --targetarch=armel
2 /overlay.armel.Debug/test/test.dll
Compilation string for arm is:
./corerun ilc.dll --codegenopt "JitDisasm=*" --codegenopt "AltJitNgen=*" @/overlay.arm.Debug/test/base.ilc.rsp
Compilation string for armel is:
./corerun ilc.dll --codegenopt "JitDisasm=*" --codegenopt "AltJitNgen=*" @/overlay.armel.Debug/test/base.ilc.rsp
Linking for arm
Linking: /dotnet/corert/cross/rootfs/x86/overlay.arm.Debug/test/test
clang -target arm-linux-gnueabihf --sysroot=/dotnet/corert/cross/rootfs/arm \
-B/dotnet/corert/cross/arm /dotnet/corert/cross/rootfs/x86/overlay.arm.Debug/test/test.o -o /dotnet/corert/cross/rootfs/x86/overlay.arm.Debug/test/test /dotnet/corert/cross/rootfs/x86/overlay.arm.Debug/sdk/libbootstrapper.a /dotnet/corert/cross/rootfs/x86/overlay.arm.Debug/sdk/libRuntime.a /dotnet/corert/cross/rootfs/x86/overlay.arm.Debug/sdk/libSystem.Private.CoreLib.Native.a /dotnet/corert/cross/rootfs/x86/overlay.arm.Debug/sdk/libSystem.Private.TypeLoader.Native.a /dotnet/corert/cross/rootfs/x86/overlay.arm.Debug/framework/System.Native.a /dotnet/corert/cross/rootfs/x86/overlay.arm.Debug/framework/System.Globalization.Native.a -g -Wl,-rpath,'$ORIGIN' -pthread -lstdc++ -ldl -lm -luuid -lrt -fPIC
Linkded: /dotnet/corert/cross/rootfs/x86/overlay.arm.Debug/test/test
Linking for armel
Linking: /dotnet/corert/cross/rootfs/x86/overlay.armel.Debug/test/test
clang++-3.9 -target arm-linux-gnueabi --sysroot=/dotnet/corert/cross/rootfs/armel \
-B/dotnet/corert/cross/armel /dotnet/corert/cross/rootfs/x86/overlay.armel.Debug/test/test.o -o /dotnet/corert/cross/rootfs/x86/overlay.armel.Debug/test/test /dotnet/corert/cross/rootfs/x86/overlay.armel.Debug/sdk/libbootstrapper.a /dotnet/corert/cross/rootfs/x86/overlay.armel.Debug/sdk/libRuntime.a /dotnet/corert/cross/rootfs/x86/overlay.armel.Debug/sdk/libSystem.Private.CoreLib.Native.a /dotnet/corert/cross/rootfs/x86/overlay.armel.Debug/sdk/libSystem.Private.TypeLoader.Native.a /dotnet/corert/cross/rootfs/x86/overlay.armel.Debug/framework/System.Native.a /dotnet/corert/cross/rootfs/x86/overlay.armel.Debug/framework/System.Globalization.Native.a -g -Wl,-rpath,'$ORIGIN' -pthread -lstdc++ -ldl -lm -luuid -lrt -fPIC
Linkded: /dotnet/corert/cross/rootfs/x86/overlay.armel.Debug/test/test
The following code leads to SIGSEGV:
The call stack:
System.Private.CoreLib/src/System/Number.Unix.cs: DoubleToNumber
Common/src/Interop/Unix/System.Private.CoreLib.Native/Interop.Number.cs: DoubleToString
Native/System.Private.CoreLib.Native/pal_cruntime.cpp: CoreLibNative_DoubleToString
glibc: vsnprintf.c
The
pal_cruntime.cpp
is compiled with clang:The root cause of the issue: jit placed double in R0, R1 registers:
but the function CoreLibNative_DoubleToString() (compiled with clang) expects double in d0:
Then the float value is used as pointer to buffer and application crashed:
armel is not affected. @alpencolt