Skip to content

Fix the BOLT problem with GCC10. #8495

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions Zend/zend_vm_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -52134,6 +52134,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NULL_HANDLER(ZEND_OPCODE_HANDL
# pragma GCC push_options
# pragma GCC optimize("no-gcse")
# pragma GCC optimize("no-ivopts")
#ifdef HAVE_BOLT
# pragma GCC optimize("no-reorder-blocks-and-partition")
#endif
#endif
ZEND_API void execute_ex(zend_execute_data *ex)
{
Expand Down
3 changes: 3 additions & 0 deletions Zend/zend_vm_execute.skl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# pragma GCC push_options
# pragma GCC optimize("no-gcse")
# pragma GCC optimize("no-ivopts")
#ifdef HAVE_BOLT
# pragma GCC optimize("no-reorder-blocks-and-partition")
Copy link
Member

@dstogov dstogov Oct 9, 2023

Choose a reason for hiding this comment

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

The flag -fno-reorder-blocks-and-partition should be passed to CC through CFLAGS in Makefile.

  • Using this line here won't disable this optimization for other files.
  • This disables useful optimization for usual PHP builds

#endif
#endif
ZEND_API void {%EXECUTOR_NAME%}_ex(zend_execute_data *ex)
{
Expand Down
4 changes: 3 additions & 1 deletion ext/hash/xxhash/xxhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -2934,8 +2934,10 @@ enum XXH_VECTOR_TYPE /* fake enum */ {
&& defined(__OPTIMIZE__) && !defined(__OPTIMIZE_SIZE__) /* respect -O0 and -Os */
# pragma GCC push_options
# pragma GCC optimize("-O2")
#ifdef HAVE_BOLT
# pragma GCC optimize("no-reorder-blocks-and-partition")
Copy link
Member

Choose a reason for hiding this comment

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

Are all of these changes actually needed, or only this one (because it overrides with -O2)? If it's only this one that's really necessary, I think we can just drop the GCC optimize usage here entirely.

Copy link
Author

Choose a reason for hiding this comment

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

Agree. Seems -O2 is not necessary here, we should remove this logic.

#endif
#endif


#if XXH_VECTOR == XXH_NEON
/*
Expand Down
3 changes: 3 additions & 0 deletions ext/standard/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ static inline int has_crc32_insn() {
# if defined(__GNUC__) && !defined(__clang__)
# pragma GCC push_options
# pragma GCC target ("+nothing+crc")
#ifdef HAVE_BOLT
# pragma GCC optimize("no-reorder-blocks-and-partition")
# endif
# endif
static uint32_t crc32_aarch64(uint32_t crc, const char *p, size_t nr) {
while (nr >= sizeof(uint64_t)) {
Expand Down