Skip to content
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

[asan][Darwin] Use Apples blocks extension only when supported (#72639) #72642

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

tob2
Copy link
Contributor

@tob2 tob2 commented Nov 17, 2023

Issue #72639

The commit at 020cdaf broke build of asan on macOS with GCC. GCC does not support the Apple blocks extension (yet). Uses of blocks in other parts of the sanitisers are protected by MISSING_BLOCKS_SUPPORT. But the type definition is not.

This applies FX's patch from the issue.

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 17, 2023

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Tobias Burnus (tob2)

Changes

Issue #72639

The commit at 020cdaf broke build of asan on macOS with GCC. GCC does not support the Apple blocks extension (yet). Uses of blocks in other parts of the sanitisers are protected by MISSING_BLOCKS_SUPPORT. But the type definition is not.

This applies FX's patch from the issue.


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

1 Files Affected:

  • (modified) compiler-rt/lib/asan/asan_mac.cpp (+2)
diff --git a/compiler-rt/lib/asan/asan_mac.cpp b/compiler-rt/lib/asan/asan_mac.cpp
index 5d5146e0cde0ba9..6252fa20d5e740f 100644
--- a/compiler-rt/lib/asan/asan_mac.cpp
+++ b/compiler-rt/lib/asan/asan_mac.cpp
@@ -139,9 +139,11 @@ typedef void (*dispatch_mach_handler_function_t)(void *context,
                                                  dispatch_mach_reason reason,
                                                  dispatch_mach_msg_t message,
                                                  mach_error_t error);
+#if !defined(MISSING_BLOCKS_SUPPORT)
 typedef void (^dispatch_mach_handler_t)(dispatch_mach_reason reason,
                                         dispatch_mach_msg_t message,
                                         mach_error_t error);
+#endif
 
 // A wrapper for the ObjC blocks used to support libdispatch.
 typedef struct {

Copy link

github-actions bot commented Nov 17, 2023

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Member

@thesamesam thesamesam left a comment

Choose a reason for hiding this comment

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

LGTM but I can't formally approve.

…72639)

The commit at 020cdaf broke build of asan on macOS with GCC. GCC does not
support the Apple blocks extension (yet). Uses of blocks in other parts
of the sanitisers are protected by MISSING_BLOCKS_SUPPORT. But the type
definition is not.
@fxcoudert
Copy link
Contributor

I can confirm that this patches fixes the build issue, and induces no regression in GCC. Could it be reviewed and merged? 🙏

@MaskRay MaskRay merged commit e0e827c into llvm:main Dec 7, 2023
3 checks passed
@fxcoudert
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants