-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Fix Linux x86 build #50836
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 Linux x86 build #50836
Conversation
Tagging subscribers to this area: @hoyosjs Issue DetailsAfter this change next subsets can be built: Related issue: #40003 cc @alpencolt
|
255716d
to
70ae805
Compare
@@ -594,6 +594,7 @@ class CMiniMdBase : public IMetaModelCommonRO | |||
|
|||
|
|||
protected: | |||
DAC_ALIGNAS(8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @sdmaclea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure why alignment to 8 is needed. I would rather expect DAC_ALIGNAS(IMetaModelCommonRO).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In src/coreclr/md/inc/VerifyLayouts.inc
there's a 8byte alignment check for m_Schema:
BEGIN_TYPE(CMiniMdBase, 8) //vtable ptr and first field 8-byte alignment
ALIGN_FIELD(CMiniMdBase, m_Schema, sizeof(CMiniMdSchema), 8)
This check started to fail after recent changes to CMiniMdBase and CMiniMdSchema, where new class fields were added. So, I've added explicit 8 byte alignment
70ae805
to
c6ae5b0
Compare
In general this looks reasonable to me. Adding @janvorli as one of the few people familiar with our pre-existing runtime support for Linux x86. Once this PR has been resolved against the current runtime main and demonstrated passing PR testing, I believe it to be ready to be merged in. |
2c60c01
to
2f475ef
Compare
Rebased with some additional changes after #49906 |
src/coreclr/vm/callingconvention.h
Outdated
} | ||
case ELEMENT_TYPE_PTR: | ||
case ELEMENT_TYPE_PTR: | ||
FALLTHROUGH; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these need the FALLTHROUGH, call you please remove them here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll remove this
SetObjectReference(pObjRef, objRef); | ||
GCPROTECT_END(); | ||
} | ||
VOID SetStaticOBJECTREF(OBJECTREF objRef); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for moving this method out of the header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also related to access to FieldDesc on linux x86 in IsArgumentInRegister
. Otherwise, there are build errors with SetStaticOBJECTREF defined in header, since now "field.h" is included in "common.h"
@@ -5415,7 +5415,7 @@ NOINLINE static void JIT_ReversePInvokeEnterRare2(ReversePInvokeFrame* frame, vo | |||
// As a result, we specially decorate this method to have the correct calling convention | |||
// and argument ordering for an HCALL, but we don't use the HCALL macros and contracts | |||
// since this method doesn't follow the contracts. | |||
void F_CALL_CONV HCCALL3(JIT_ReversePInvokeEnterTrackTransitions, ReversePInvokeFrame* frame, CORINFO_METHOD_HANDLE handle, void* secretArg) | |||
HCIMPL3_RAW(void, JIT_ReversePInvokeEnterTrackTransitions, ReversePInvokeFrame* frame, CORINFO_METHOD_HANDLE handle, void* secretArg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the reason for switching some of the helpers calling convention. Can you please explain the purpose of these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling convention doesn't change here. Actual problem is incorrect usage of HCCALL3
macro: it should be used to call function. HCIMPL3_RAW
should be used for declaration instead.
@@ -367,6 +367,7 @@ inline void ClrRestoreNonvolatileContext(PCONTEXT ContextRecord) | |||
#include "pefile.inl" | |||
#include "excep.h" | |||
#include "method.hpp" | |||
#include "field.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which part of the change needs to have the field.h include here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required on linux x86, because IsArgumentInRegister
accesses FieldDesc. Otherwise:
/home/z/Dev/runtime3/src/coreclr/binder/../vm/callingconvention.h:416:46: error: member access into incomplete type 'FieldDesc'
CorElementType type = pFD->GetFieldType();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please instead move the #include "frames.h"
above the #include "field.h"
and revert the change in field.h
and field.cpp
? I've verified it compiles fine on x86 Linux that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still get the original build error this way, because "frames.h"
itself includes "callingconvention.h"
, which requires "field.h"
on x86. So, if "frames.h"
is above "field.h"
there still is error: member access into incomplete type 'FieldDesc'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I am sorry, I've found I've forgotten to add "cross" to my command line when trying to build for x86. Please keep it as you had it.
@@ -153,7 +153,7 @@ extern "C" | |||
return TRUE; | |||
} | |||
|
|||
extern "C" DLLEXPORT void __stdcall jitStartup(ICorJitHost* host) | |||
extern "C" DLLEXPORT void jitStartup(ICorJitHost* host) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BruceForstall is the __stdcall removal ok?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is ok. We preffer to just use default calling convention whenever possible.
2f475ef
to
5fac123
Compare
5fac123
to
37717f6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Can this be merged? |
@gbalykov the libraries tests are failing on Windows x86 in this PR, it might be related. Let me re-run them to see. |
37717f6
to
218272b
Compare
218272b
to
6c63f03
Compare
@janvorli I've rebased on latest master, test fails don't seem to be related, am I right? |
@gbalykov right, they are in unrelated. |
Thanks! |
After this change next subsets can be built:
clr.runtime+clr.corelib+clr.iltools+clr.dactools+clr.jit
Related issue: #40003
cc @alpencolt