Zend/zend_atomic.h: fix build for upcoming gcc-14#12821
Closed
trofi wants to merge 1 commit into
Closed
Conversation
Member
|
\cc @morrisonlevi |
fweimer-rh
reviewed
Dec 4, 2023
Contributor
There was a problem hiding this comment.
I believe if you use the <stdatomic.h> builtins, you need to use memory_order_seq_cst from <stdatomi.h> as well, not the implementation-specific __ATOMIC_SEQ_CST constant.
Author
There was a problem hiding this comment.
Great catch! Completely forgot about the arguments. Changed to memory_order_seq_cst in all 3 places.
In gcc.gnu.org/PR60512 `gcc-14` implemented `c_atomic` feature and
exposed build failure on `php` as:
/build/php-8.2.13/Zend/zend_atomic.h: In function 'zend_atomic_bool_store_ex':
/build/php-8.2.13/Zend/zend_atomic.h:96:9: warning: implicit declaration of function '__c11_atomic_store'; did you mean '__atomic_store'? [-Wimplicit-function-declaration]
96 | __c11_atomic_store(&obj->value, desired, __ATOMIC_SEQ_CST);
| ^~~~~~~~~~~~~~~~~~
| __atomic_store
...
ld: /build/php-8.2.13/Zend/zend_atomic.h:96:(.text+0x1301): undefined reference to `__c11_atomic_store'
ld: /build/php-8.2.13/Zend/zend_atomic.h:96:(.text+0x1e49): undefined reference to `__c11_atomic_store'
As I understand the build failure happens because `php` uses `clang`'s
internal functions prefixed with `__c11_*` that implement atomics instead
of standard-defined `atomic_*` ones. `gcc` implements ony standard-defined
ones.
The change fixes build for me.
gcc-14gcc-14
Contributor
|
Note that #ifndef ZTS ... memory_order AFAIK needs to be memory_order_relaxed instead. |
Author
|
Was worked around by 7252660 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In https://gcc.gnu.org/PR60512
gcc-14implementedc_atomicfeature and exposed build failure onphpas:As I understand the build failure happens because
phpusesclang's internal functions prefixed with__c11_*that implement atomics instead of standard-definedatomic_*ones.gccimplements ony standard-defined ones.The change fixes build for me.