diff mbox series

[pushed] libsanitizer, Darwin, Bootstrap : Fix bootstrap on Darwin <= 15.

Message ID D5D5AAA4-AD5B-4239-9796-C70CCE443D5C@sandoe.co.uk
State New
Headers show
Series [pushed] libsanitizer, Darwin, Bootstrap : Fix bootstrap on Darwin <= 15. | expand

Commit Message

Iain Sandoe Oct. 18, 2020, 8 p.m. UTC
Hi

The latest upstream merge for libsanitizer introduces code that makes
use of some macro values that are not available in SDKs for versions
of Darwin <= 15 (macOS 10.11).

[TBH, I am a bit surprised by this, I was under the impression that upstream
 supported versions back to Darwin11 / macOS 10.7]

Add definitions for these where they are not present.

tested on Darwin9 -> Darwin19 and x86_64-linux
pushed to master
thanks
Iain

P.S. I will also add this change to LOCAL_PATCHES.

libsanitizer/ChangeLog:

	* sanitizer_common/sanitizer_mac.h: Ensure that TARGET_OS_
	macros are defined where the macOS SDK does not contain
	them.
	(TARGET_OS_OSX, TARGET_OS_IOS, TARGET_OS_TV, TARGET_OS_WATCH):
	Define where needed.
---
 libsanitizer/sanitizer_common/sanitizer_mac.h | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Martin Liška Oct. 19, 2020, 7:07 a.m. UTC | #1
On 10/18/20 10:00 PM, Iain Sandoe wrote:
> Hi

Hello.

> 
> The latest upstream merge for libsanitizer introduces code that makes
> use of some macro values that are not available in SDKs for versions
> of Darwin <= 15 (macOS 10.11).
> 
> [TBH, I am a bit surprised by this, I was under the impression that upstream
>   supported versions back to Darwin11 / macOS 10.7]
> 
> Add definitions for these where they are not present.

Thank you for the fix. However, I've just checked the upstream changes, and I can't
find a commit that would touch the mentioned macros.

> 
> tested on Darwin9 -> Darwin19 and x86_64-linux
> pushed to master
> thanks
> Iain
> 
> P.S. I will also add this change to LOCAL_PATCHES.

I've just done that.

Thanks,
Martin

> 
> libsanitizer/ChangeLog:
> 
> 	* sanitizer_common/sanitizer_mac.h: Ensure that TARGET_OS_
> 	macros are defined where the macOS SDK does not contain
> 	them.
> 	(TARGET_OS_OSX, TARGET_OS_IOS, TARGET_OS_TV, TARGET_OS_WATCH):
> 	Define where needed.
> ---
>   libsanitizer/sanitizer_common/sanitizer_mac.h | 20 +++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 
> diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.h b/libsanitizer/sanitizer_common/sanitizer_mac.h
> index 023071e4f11..a2c42b3bf4f 100644
> --- a/libsanitizer/sanitizer_common/sanitizer_mac.h
> +++ b/libsanitizer/sanitizer_common/sanitizer_mac.h
> @@ -14,6 +14,26 @@
>   
>   #include "sanitizer_common.h"
>   #include "sanitizer_platform.h"
> +
> +/* TARGET_OS_OSX is not present in SDKs before Darwin16 (macOS 10.12) use
> +   TARGET_OS_MAC (we have no support for iOS in any form for these versions,
> +   so there's no ambiguity).  */
> +#if !defined(TARGET_OS_OSX) && TARGET_OS_MAC
> +# define TARGET_OS_OSX 1
> +#endif
> +
> +/* Other TARGET_OS_xxx are not present on earlier versions, define them to
> +   0 (we have no support for them; they are not valid targets anyway).  */
> +#ifndef TARGET_OS_IOS
> +#define TARGET_OS_IOS 0
> +#endif
> +#ifndef TARGET_OS_TV
> +#define TARGET_OS_TV 0
> +#endif
> +#ifndef TARGET_OS_WATCH
> +#define TARGET_OS_WATCH 0
> +#endif
> +
>   #if SANITIZER_MAC
>   #include "sanitizer_posix.h"
>   
>
diff mbox series

Patch

diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.h b/libsanitizer/sanitizer_common/sanitizer_mac.h
index 023071e4f11..a2c42b3bf4f 100644
--- a/libsanitizer/sanitizer_common/sanitizer_mac.h
+++ b/libsanitizer/sanitizer_common/sanitizer_mac.h
@@ -14,6 +14,26 @@ 
 
 #include "sanitizer_common.h"
 #include "sanitizer_platform.h"
+
+/* TARGET_OS_OSX is not present in SDKs before Darwin16 (macOS 10.12) use
+   TARGET_OS_MAC (we have no support for iOS in any form for these versions,
+   so there's no ambiguity).  */
+#if !defined(TARGET_OS_OSX) && TARGET_OS_MAC
+# define TARGET_OS_OSX 1
+#endif
+
+/* Other TARGET_OS_xxx are not present on earlier versions, define them to
+   0 (we have no support for them; they are not valid targets anyway).  */
+#ifndef TARGET_OS_IOS
+#define TARGET_OS_IOS 0
+#endif
+#ifndef TARGET_OS_TV
+#define TARGET_OS_TV 0
+#endif
+#ifndef TARGET_OS_WATCH
+#define TARGET_OS_WATCH 0
+#endif
+
 #if SANITIZER_MAC
 #include "sanitizer_posix.h"