Skip to content

Attempt to fix build #9087 on macOs intel. #9170

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/zend_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <stdint.h>

/* This is the heart of the whole int64 enablement in zval. */
#if defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64)
#if !defined(__APPLE__) && (defined(__x86_64__) || defined(__LP64__) || defined(_LP64) || defined(_WIN64))
Copy link
Member

Choose a reason for hiding this comment

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

Ugh, it would be pretty sad, if we couldn't have 64bit integers on macOS.

Copy link
Member Author

@devnexen devnexen Jul 28, 2022

Choose a reason for hiding this comment

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

Yes I know, not too "proud" about it :-) ... but either we "ignore" the failed test if we re sure it works well in fact in real hardware, mac Intel is a dying trend but will take a certain time to actually die.

Copy link
Member

Choose a reason for hiding this comment

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

I'd assume the vast majority of people use a 64-bit build of PHP and might thus implicitly be depending on 64-bit integers. @devnexen Just disabling zend_string_equal_val for macOS doesn't do it?

Copy link
Member Author

@devnexen devnexen Jul 28, 2022

Choose a reason for hiding this comment

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

oh for sure it builds if I do what you say but ... the main "issue" still remain then

image

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, what is the diff? In #9087 it is:

     sscanf 64-bit signed int '9223372036854775807'  (2^63)-1 = 9223372036854775807
     sscanf 64-bit unsign int '18446744073709551615' (2^64)-1 = 18446744073709551615
     printf 64-bit signed int '9223372036854775807'  (2^63)-1 = 9223372036854775807
007+ printf 64-bit signed int '18446744073709551615' (2^64)-1 = 9223372036854775808
007- printf 64-bit signed int '18446744073709551615' (2^64)-1 = 0
     Done

That doesn't look like a general 64bit integer issue; and frankly, that part of the test looks fishy anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

anyhow

but either we "ignore" the failed test

@zeriyoshi said the test pass w/o issue in his intel mac.

Copy link
Member

@iluuu1994 iluuu1994 Jul 28, 2022

Choose a reason for hiding this comment

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

Do we support ARM for mac? Does it work without Rosetta?
It's not listed in https://wiki.php.net/platforms at least.

Copy link
Member

Choose a reason for hiding this comment

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

The point is that I would like to understand why this test fails on some platforms, and also, why it passes on (most) others. It doesn't appear to be related to the size of integers, since 18446744073709551615 is supposed to be parsed as float anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we support ARM for mac? Does it work without Rosetta? It's not listed in https://wiki.php.net/platforms at least.

It does pass w/o issue on pure arm mode then my fix is not appropriate indeed.

# define ZEND_ENABLE_ZVAL_LONG64 1
#endif

Expand Down
2 changes: 2 additions & 0 deletions Zend/zend_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ ZEND_API bool ZEND_FASTCALL I_REPLACE_SONAME_FNNAME_ZU(NONE,zend_string_equal_va
return !memcmp(ZSTR_VAL(s1), ZSTR_VAL(s2), ZSTR_LEN(s1));
}

#if !defined(__APPLE__)
#if defined(__GNUC__) && defined(__i386__)
ZEND_API bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2)
{
Expand Down Expand Up @@ -451,6 +452,7 @@ ZEND_API bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const z
return ret;
}
#endif
#endif

ZEND_API zend_string *zend_string_concat2(
const char *str1, size_t str1_len,
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ static zend_always_inline bool zend_string_equals_cstr(const zend_string *s1, co
return ZSTR_LEN(s1) == s2_length && !memcmp(ZSTR_VAL(s1), s2, s2_length);
}

#if defined(__GNUC__) && (defined(__i386__) || (defined(__x86_64__) && !defined(__ILP32__)))
#if defined(__GNUC__) && !defined(__APPLE__) && (defined(__i386__) || (defined(__x86_64__) && !defined(__ILP32__)))
BEGIN_EXTERN_C()
ZEND_API bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2);
END_EXTERN_C()
Expand Down