Skip to content

Change 'isValidPointerForNativeRetain' check for PowerPC(ppc64le) #21038

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

Merged
merged 2 commits into from
Dec 12, 2018
Merged

Change 'isValidPointerForNativeRetain' check for PowerPC(ppc64le) #21038

merged 2 commits into from
Dec 12, 2018

Conversation

sarveshtamba
Copy link
Contributor

Change 'isValidPointerForNativeRetain' check for PowerPC(ppc64le)

Resolves a crash trying to retain the BridgeObject on PowerPC(ppc64le).

@@ -61,7 +61,7 @@ using namespace swift;
/// Returns true if the pointer passed to a native retain or release is valid.
/// If false, the operation should immediately return.
static inline bool isValidPointerForNativeRetain(const void *p) {
#if defined(__x86_64__) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) || defined(__s390x__)
#if defined(__x86_64__) || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) || defined(__s390x__) || defined(__powerpc64__) || defined(__ppc__) || defined(__PPC__) || defined(__LITTLE_ENDIAN__)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think __ppc__ or __PPC__ are appropriate, since those could conceivably be 32-bit PPC as well. __LITTLE_ENDIAN__ is definitely not correct here. Is __powerpc64__ sufficient?

Copy link
Member

@compnerd compnerd Dec 5, 2018

Choose a reason for hiding this comment

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

Why is __LITTLE_ENDIAN__ being added unconditionally? Shouldn't it really be || (defined(__powerpc64__) && defined(__LITTLE_ENDIAN__))? I believe that you are targeting ppc64le rather than the previous PPC64 BE ABI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the condition as suggested || (defined(powerpc64) && defined(LITTLE_ENDIAN)) above and tested the same. Please review commit 7dbda78

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can this be approved and merged now? Thanks in advance!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @compnerd @mikeash , can you please review this? This PR is resolving a blocker while building swift toolchain on PowerPC64LE and is a bit urgent. Since this is a small change, can you please take this up? Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for letting this sit. The new version looks good. I'll kick off testing and merge it upon success.

Copy link
Contributor

Choose a reason for hiding this comment

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

And merged. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @mikeash!

@mikeash
Copy link
Contributor

mikeash commented Dec 12, 2018

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants