https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96798

--- Comment #9 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #8)
> (In reply to Iain Sandoe from comment #7)
> > (In reply to David Malcolm from comment #6)
> > > Thanks!  The "memset" call has become a call to "__builtin___memset_chk"
> > > (perhaps due to _FORTIFY_SOURCE, or something similar in Darwin's libc?),
> > 
> > (transitive include of strings.h, for macOS >= 10.5)
> > usr/include/_types.h:#    define _FORTIFY_SOURCE 2  /* on by default */
> > 
> > usr/include/strings.h:
> > 
> > #if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus)
> > /* Security checking functions.  */
> > #include <secure/_strings.h>
> > #endif
> > 
> > 
> > secure/_strings.h:
> > 
> > #if _USE_FORTIFY_LEVEL > 0
> > 
> > ....
> > 
> > #if __has_builtin(__builtin___memset_chk) || defined(__GNUC__)
> > #undef bzero
> > /* void bzero(void *s, size_t n) */
> > #define bzero(dest, ...) \
> >                 __builtin___memset_chk (dest, 0, __VA_ARGS__, __darwin_obsz0
> > (dest))
> > #endif
> > 
> 
> Oops hit send too soon.
> 
> string.h is a transitive include of strings.h and has:
> #if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus)
> /* Security checking functions.  */
> #include <secure/_string.h>
> #endif
> 
> _strings.h:
^^ typo -- secure/_string.h:
> 
> #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 ||
> __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 || \
>                 defined(__DRIVERKIT_VERSION_MIN_REQUIRED)
> #if __has_builtin(__builtin___memccpy_chk) && __HAS_FIXED_CHK_PROTOTYPES
> #undef memccpy
> /* void *memccpy(void *dst, const void *src, int c, size_t n) */
> #define memccpy(dest, ...) \
>                 __builtin___memccpy_chk (dest, __VA_ARGS__, __darwin_obsz0
> (dest))
> #endif
> #endif
> 
> So.. essentially, the checked builtins are going to be used everywhere by
> default on modern Darwin (and some are going to be used even on venerable
> Darwin).

Reply via email to