Skip to content

Support Linux on z #386

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 3 commits into from
Jun 6, 2016
Merged

Support Linux on z #386

merged 3 commits into from
Jun 6, 2016

Conversation

vivkong
Copy link
Contributor

@vivkong vivkong commented May 25, 2016

@@ -165,7 +165,11 @@ struct __CFConstStr {
uint8_t _pad[4];
} _base;
uint8_t *_ptr;
#if __LP64__
uint64_t _length;
#else
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, this is always a uint32_t on other platforms, even in 64 bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have changed the code to use unsigned long instead (same as the length field in __CFString struct which is of type CFIndex)

@@ -165,7 +165,7 @@ struct __CFConstStr {
uint8_t _pad[4];
} _base;
uint8_t *_ptr;
uint32_t _length;
signed long _length;
Copy link
Contributor

Choose a reason for hiding this comment

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

Signed?

Copy link
Contributor Author

@vivkong vivkong May 26, 2016

Choose a reason for hiding this comment

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

I meant to change it to be the same as the length field in __CFString struct which is of type CFIndex. CFIndex is signed long. I can change it to unsigned

@@ -165,7 +165,7 @@ struct __CFConstStr {
uint8_t _pad[4];
} _base;
uint8_t *_ptr;
uint32_t _length;
unsigned long _length;
Copy link
Contributor

Choose a reason for hiding this comment

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

This must remain the same since the emission is determined by what clang itself emits (and has emitted for previously compiled libraries) this layout is paired not only to the emission of @"" but also CFSTR("")

Copy link
Contributor

Choose a reason for hiding this comment

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

If it is needed for this platform to change then it should have an ifdef for gating the change only for that specific platform.

Choose a reason for hiding this comment

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

The aliasing of a 32-bit _length field with a 64-bit CFIndex field will not work on any 64-bit big-endian system (e.g. s390x and powerpc64). So I believe the guard should be:

#if defined(__LP64__) && defined(__BIG_ENDIAN__)

@vivkong
Copy link
Contributor Author

vivkong commented May 26, 2016

Thank you everyone for the reviews. I appreciate the feedback and have made changes based on the suggestions.

@vivkong vivkong force-pushed the s390x-init branch 3 times, most recently from 9e20ded to ecb8012 Compare May 26, 2016 19:31
#define HALT do {__builtin_trap(); kill(getpid(), 9); __builtin_unreachable(); } while (0)
#else
#error Compiler not supported
#endif
Copy link
Member

Choose a reason for hiding this comment

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

BTW, it would be nice to rebase this on #372 . It collapses the duplication.

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. I've rebased on top of it.

@vivkong
Copy link
Contributor Author

vivkong commented Jun 6, 2016

Wondering if there are other comments or suggestions for this PR? Thanks.

@parkera
Copy link
Contributor

parkera commented Jun 6, 2016

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

6 participants