Skip to content

[libc++] Fix build failure with libdispatch backend #141606

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 1 commit into from
May 28, 2025

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented May 27, 2025

We get an error "cannot add 'abi_tag' attribute in a redeclaration" because functions like __dispatch_apply are first declared without an ABI tag due to _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS inside the header, and then redeclared with an ABI tag in the .cpp file.

We get an error "cannot add 'abi_tag' attribute in a redeclaration"
because functions like `__dispatch_apply` are first declared without
an ABI tag due to `_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS` inside
the header, and then redeclared with an ABI tag in the .cpp file.
@ldionne ldionne requested a review from a team as a code owner May 27, 2025 13:57
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label May 27, 2025
@llvmbot
Copy link
Member

llvmbot commented May 27, 2025

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

We get an error "cannot add 'abi_tag' attribute in a redeclaration" because functions like __dispatch_apply are first declared without an ABI tag due to _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS inside the header, and then redeclared with an ABI tag in the .cpp file.


Full diff: https://github.com/llvm/llvm-project/pull/141606.diff

1 Files Affected:

  • (modified) libcxx/src/pstl/libdispatch.cpp (+2)
diff --git a/libcxx/src/pstl/libdispatch.cpp b/libcxx/src/pstl/libdispatch.cpp
index 3dca702341c85..528018358eeb0 100644
--- a/libcxx/src/pstl/libdispatch.cpp
+++ b/libcxx/src/pstl/libdispatch.cpp
@@ -12,6 +12,7 @@
 #include <dispatch/dispatch.h>
 
 _LIBCPP_BEGIN_NAMESPACE_STD
+_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
 namespace __pstl::__libdispatch {
 
 void __dispatch_apply(size_t chunk_count, void* context, void (*func)(void* context, size_t chunk)) noexcept {
@@ -29,4 +30,5 @@ __chunk_partitions __partition_chunks(ptrdiff_t element_count) noexcept {
 }
 
 } // namespace __pstl::__libdispatch
+_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS
 _LIBCPP_END_NAMESPACE_STD

@ldionne ldionne merged commit 5659471 into llvm:main May 28, 2025
49 of 54 checks passed
@ldionne ldionne deleted the review/fix-pstl-libdispatch branch May 28, 2025 14:20
ldionne added a commit that referenced this pull request May 28, 2025
It turns out that we're about to revert the patches that added these
annotations in the first place. I was too hasty to land this.

This reverts commit 5659471.
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
We get an error "cannot add 'abi_tag' attribute in a redeclaration"
because functions like `__dispatch_apply` are first declared without an
ABI tag due to `_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS` inside the
header, and then redeclared with an ABI tag in the .cpp file.
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
)"

It turns out that we're about to revert the patches that added these
annotations in the first place. I was too hasty to land this.

This reverts commit 5659471.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants