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] Unprotected use of Apple blocks breaks build with GCC #72639

Open
fxcoudert opened this issue Nov 17, 2023 · 2 comments
Open

[asan][Darwin] Unprotected use of Apple blocks breaks build with GCC #72639

fxcoudert opened this issue Nov 17, 2023 · 2 comments

Comments

@fxcoudert
Copy link
Contributor

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.

Could the same thing be done here? This works for me (tested in a build of asan inside GCC):

diff --git a/libsanitizer/asan/asan_mac.cpp b/libsanitizer/asan/asan_mac.cpp
index 5d5146e0cde..6252fa20d5e 100644
--- a/libsanitizer/asan/asan_mac.cpp
+++ b/libsanitizer/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 {
@thesamesam
Copy link
Member

Could you submit that as a PR? Thanks.

@thesamesam
Copy link
Member

cc @thetruestblue

tob2 pushed a commit to tob2/llvm-project that referenced this issue Nov 17, 2023
…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.
nstester pushed a commit to nstester/gcc that referenced this issue Nov 18, 2023
Upstream report of the issue at
llvm/llvm-project#72639

libsanitizer/ChangeLog:

	* asan/asan_mac.cpp: Protect Apple blocks behind the
	MISSING_BLOCKS_SUPPORT macro.
MaskRay pushed a commit that referenced this issue Dec 7, 2023
… (#72642)

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._

Co-authored-by: FX Coudert <fxcoudert@gmail.com>
Blackhex pushed a commit to Windows-on-ARM-Experiments/gcc-woarm64 that referenced this issue Dec 18, 2023
Upstream report of the issue at
llvm/llvm-project#72639

libsanitizer/ChangeLog:

	* asan/asan_mac.cpp: Protect Apple blocks behind the
	MISSING_BLOCKS_SUPPORT macro.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants