From: Gábor Stefanik <[email-masked]>
Date: Tue, 7 Jan 2025 03:34:59 +0100

Between 2.35 and 2.38, glibc added the following code to sys/mount.h:

> #ifdef __has_include
> # if __has_include ("linux/mount.h")
> #  include "linux/mount.h"
> # endif
> #endif

This is then used to conditionally define structures that would be in
linux/mount.h, in case linux/mount.h is either unavailable or missing
those structures.

The __has_include directive was added to GCC in v5.0, and didn't
become standard until C++17. Unfortunately, this causes the first
#ifdef to fail, and so linux/mount.h is never checked. Any code trying
to include both sys/mount.h and linux/mount.h will therefore fail when
compiled with GCC < 5.0 and glibc >= 2.38.

Possible solutions:
* Patch sys/mount.h to make it include linux/mount.h unconditionally
on all platforms using the Linux kernel.
* Somehow remove linux/mount.h from GCC 4.9's
sanitizer_platform_limits_posix.cc. Unfortunately it's an indirect
include from linux/fs.h.