Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix helloworld on x86 Linux #55095

Merged
merged 2 commits into from
Jul 9, 2021
Merged

Conversation

t-mustafin
Copy link
Contributor

Working on helloworld.dll x86 linux launch I've got problem during calling convention on managed call from managed code. I fixed it in morph.cpp. After that fix I had got bugs with stack misalignment. Couple of that problems I fixed in compiler.cpp and jitinterfacex86.cpp. It allows to run helloworld.dll and stack dumping with System.Diagnostics.StackTrace. But I still have got similar stack misalignment problems on another programs.
Is that fix-work direction right? Maybe I should fix managed-managed calling convention in another way?
cc @jkotas @alpencolt

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 2, 2021
@jkotas
Copy link
Member

jkotas commented Jul 2, 2021

It looks like a reasonable direction to me.

@t-mustafin t-mustafin marked this pull request as ready for review July 7, 2021 17:11
@t-mustafin t-mustafin changed the title [WIP] Fix helloworld on x86 Linux Fix helloworld on x86 Linux Jul 7, 2021
@jkotas
Copy link
Member

jkotas commented Jul 7, 2021

A lot of tests on Windows x64 are failing with errors like:

  Fatal error. 0xC0000005
         at Microsoft.CSharp.RuntimeBinder.ComInterop.IDispatchComObject.EnsureScanDefinedMethods()

@@ -2897,7 +2900,11 @@ void Compiler::fgInitArgInfo(GenTreeCall* call)
// Compute the maximum number of arguments that can be passed in registers.
// For X86 we handle the varargs and unmanaged calling conventions

#ifdef UNIX_X86_ABI
if (call->IsVarargs())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VarArgs is not supported on Unix, so this will be always false. Would it be better to put this whole block under #ifndef UNIX_X86_ABI ?

Make managed->managed call use of ecx, edx to pass first two arguments.
Make stack alignment returning after call.
Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@jkotas jkotas merged commit 39d1161 into dotnet:main Jul 9, 2021
@t-mustafin t-mustafin deleted the fix_x86_linux_helloworld branch July 9, 2021 20:52
@ghost ghost locked as resolved and limited conversation to collaborators Aug 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants