Skip to content

Build support for s390x: PAL layer - #53287

Merged
marek-safar merged 1 commit into
dotnet:mainfrom
uweigand:s390x-clr-pal
Jun 8, 2021
Merged

Build support for s390x: PAL layer#53287
marek-safar merged 1 commit into
dotnet:mainfrom
uweigand:s390x-clr-pal

Conversation

@uweigand

Copy link
Copy Markdown
Contributor
  • Add PAL implementation for Linux on s390x

  • Define BIGENDIAN on s390x when compiling coreclr

  • Do not run HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES cmake test when
    cross-compiling

Note to reviewers:

  • The primary intent of this patch is to enable building ilasm/ildasm on s390x (even though we do not support coreclr VM/JIT)
  • However, the PAL support provided here is still complete and passes all paltests
  • As there is no Windows on s390x, there is no pre-existing CONTEXT structure, so I made one up. In particular, the CONTEXT_S390X define re-uses the same value as CONTEXT_AMD64. Let me know if I should instead choose another bit.
  • Similarly, there is no s390x PE file format, so IMAGE_FILE_MACHINE_NATIVE is defined to IMAGE_FILE_MACHINE_UNKNOWN

@ghostghost added the area-PAL-coreclr only for closed issues label May 26, 2021
@AaronRobinsonMSFT

Copy link
Copy Markdown
Member

/cc @janvorli

Comment threadsrc/coreclr/pal/src/configure.cmake 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.

This is never executed while cross compiling, cmake skips all check_*_source_runs during cross compilation. The HAVE_xxx values for cross compilation are taken from the tryrun.cmake file. So this change should not be needed, but you'll need to update the eng/native/tryrun.cmake

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, I missed that, sorry. Patch updated accordingly.

Comment threadsrc/coreclr/pal/src/thread/context.cpp Outdated
Comment threadsrc/coreclr/inc/pedecoder.h Outdated
@uweigand

Copy link
Copy Markdown
ContributorAuthor

Ping? Anything else that needs to be addressed?

Comment threadsrc/coreclr/pal/src/thread/context.cpp Outdated
Comment threadsrc/coreclr/pal/src/thread/context.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 have just noticed this #if has a wrong condition (event before your change). Since you are touching this code, could you please fix it? It should be

#if (HAVE_GREGSET_T || HAVE___GREGSET_T) && !defined(HOST_S390X)

Actually, the related #endif comment need to be updated to match your change (and this fix) to

#endif // HAVE_GREGSET_T || HAVE___GREGSET_T || !HOST_S390X

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Fixed.

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 update the matching @endif comment?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Done.

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.

A nit - in the #endif comments, the convention we use is just !HOST_S390X instead of !defined(HOST_S390X)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, I see. Updated.

* Add PAL implementation for Linux on s390x
* Define BIGENDIAN on s390x when compiling coreclr
* Provide a default HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE
value in eng/native/tryrun.cmake

@janvorlijanvorli 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!

@ghost

ghost commented Jun 7, 2021

Copy link
Copy Markdown

Hello @janvorli!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@uweigand

Copy link
Copy Markdown
ContributorAuthor

Thanks for the review! Would you mind having a look the two related PRs as well:
#53286
#53289
Both are required to get the PAL to actually build on s390x.

@marek-safar
marek-safar merged commit 5d6278a into dotnet:mainJun 8, 2021
@ghostghost locked as resolved and limited conversation to collaborators Jul 8, 2021
@uweigand
uweigand deleted the s390x-clr-pal branch July 14, 2021 22:32
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-PAL-coreclronly for closed issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@uweigand@AaronRobinsonMSFT@janvorli@marek-safar