镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fix Linux x86 build - #50836

Merged
janvorli merged 1 commit into
dotnet:mainfrom
gbalykov:fix-linux-x86-build
Jun 18, 2021
Merged

janvorli merged 1 commit into
dotnet:mainfrom
gbalykov:fix-linux-x86-build

Conversation

@gbalykov

@gbalykov gbalykov commented Apr 7, 2021

Copy link
Copy Markdown
Member

After this change next subsets can be built: clr.runtime+clr.corelib+clr.iltools+clr.dactools+clr.jit

Related issue: #40003

cc @alpencolt

@ghost ghost added the area-Infrastructure-coreclr Only use for closed issues label Apr 7, 2021
@ghost

ghost commented Apr 7, 2021

Copy link
Copy Markdown

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

Issue Details

After this change next subsets can be built: clr.runtime+clr.corelib+clr.iltools+clr.dactools+clr.jit

Related issue: #40003

cc @alpencolt

Author: gbalykov
Assignees: -
Labels:

area-Infrastructure-coreclr

Milestone: -

Comment thread src/coreclr/vm/jithelpers.cpp Resolved
Comment thread src/coreclr/vm/jithelpers.cpp Resolved
Comment thread src/coreclr/vm/jithelpers.cpp Resolved
@gbalykov
gbalykov force-pushed the fix-linux-x86-build branch from 255716d to 70ae805 Compare April 7, 2021 19:35
@jkoritzinsky
jkoritzinsky dismissed their stale review April 7, 2021 19:42

Changes have been made.

Comment thread src/coreclr/md/inc/metamodel.h Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

cc: @sdmaclea

Copy link
Copy Markdown
Member

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).

Copy link
Copy Markdown
Member Author

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

Comment thread src/coreclr/vm/jithelpers.cpp Resolved
Comment thread src/coreclr/vm/jithelpers.cpp Resolved
@trylek

trylek commented May 10, 2021

Copy link
Copy Markdown
Member

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.

@gbalykov
gbalykov force-pushed the fix-linux-x86-build branch 2 times, most recently from 2c60c01 to 2f475ef Compare May 11, 2021 11:13
@gbalykov

Copy link
Copy Markdown
Member Author

Rebased with some additional changes after #49906

Comment thread src/coreclr/vm/callingconvention.h Outdated

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member Author

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

Comment thread src/coreclr/vm/field.h Outdated

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member Author

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"

Comment thread src/coreclr/vm/jithelpers.cpp Outdated

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member Author

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.

Comment thread src/coreclr/vm/common.h Outdated

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member Author

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();

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member Author

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'

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member

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.

@gbalykov
gbalykov force-pushed the fix-linux-x86-build branch from 2f475ef to 5fac123 Compare May 11, 2021 13:53
@gbalykov
gbalykov force-pushed the fix-linux-x86-build branch from 5fac123 to 37717f6 Compare May 19, 2021 10:52

@janvorli janvorli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you!

@janvorli janvorli closed this May 21, 2021
@janvorli janvorli reopened this May 21, 2021
@gbalykov

Copy link
Copy Markdown
Member Author

Can this be merged?

@janvorli

Copy link
Copy Markdown
Member

@gbalykov the libraries tests are failing on Windows x86 in this PR, it might be related. Let me re-run them to see.

@gbalykov
gbalykov force-pushed the fix-linux-x86-build branch from 37717f6 to 218272b Compare June 17, 2021 19:26
@gbalykov
gbalykov force-pushed the fix-linux-x86-build branch from 218272b to 6c63f03 Compare June 18, 2021 08:44
@gbalykov

Copy link
Copy Markdown
Member Author

@janvorli I've rebased on latest master, test fails don't seem to be related, am I right?

@janvorli

Copy link
Copy Markdown
Member

@gbalykov right, they are in unrelated.

@janvorli
janvorli merged commit f37f0b9 into dotnet:main Jun 18, 2021
@gbalykov

Copy link
Copy Markdown
Member Author

Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Jul 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Infrastructure-coreclr Only use for closed issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants