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

--- Comment #14 from Jose E. Marchesi <jemarch at gcc dot gnu.org> ---
It works with clang because the stdint.h installed by clang falls to "hosted"
mode only if there is an actual file to include:

  #if __STDC_HOSTED__ && __has_include_next(<stdint.h>)
  ...
  #include_next <stdint.h>
  #else
  ...
  /* Freestanding, define everything.  */
  #endif

In contrast the wrapping stdint.h installed by GCC doesn't check for the
header, and if in host mode it includes_next unconditionally:

  #ifndef _GCC_WRAP_STDINT_H
  #if __STDC_HOSTED__
  # if defined __cplusplus && __cplusplus >= 201103L
  #  undef __STDC_LIMIT_MACROS
  #  define __STDC_LIMIT_MACROS
  #  undef __STDC_CONSTANT_MACROS
  #  define __STDC_CONSTANT_MACROS
  # endif
  #pragma GCC diagnostic push
  #pragma GCC diagnostic ignored "-Wpedantic" // include_next
  # include_next <stdint.h>
  #pragma GCC diagnostic pop
  #else
  # include "stdint-gcc.h"
  #endif
  #define _GCC_WRAP_STDINT_H
  #endif

I think DTrace should use -ffreestanding or otherwise provide its own stdint.h.
 Including glibc headers (which doesn't support bpf-unknown-none) in BPF
programs is a very bad practice.

Reply via email to