path: root/tools/build/cross-build/include/linux/sys
diff options
authorJessica Clarke <jrtc27@FreeBSD.org>2021-12-15 19:45:31 +0000
committerJessica Clarke <jrtc27@FreeBSD.org>2021-12-15 19:45:31 +0000
commitaee99ab4fe38bdc1dd1be88755d99ff4ee78ec09 (patch)
tree4ff7fec9f47c5ffe161b9e80aff96cbd0935faea /tools/build/cross-build/include/linux/sys
parent03a88e3de9c68182d21df94b1c8c7ced930dbd1f (diff)
cross-build: Add comment missing from 9e5b0d9eac5b
Whilst the commit message documented some of the details, I had intended to include this comment in the actual header, but failed to amend the commit properly. Fixes: 9e5b0d9eac5b ("cross-build: Fix bmake bootstrap with glibc 2.34") MFC after: 1 week
Diffstat (limited to 'tools/build/cross-build/include/linux/sys')
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/build/cross-build/include/linux/sys/wait.h b/tools/build/cross-build/include/linux/sys/wait.h
index 2721218a83d4..ca17bfae9b8a 100644
--- a/tools/build/cross-build/include/linux/sys/wait.h
+++ b/tools/build/cross-build/include/linux/sys/wait.h
@@ -27,5 +27,21 @@
#pragma once
+ * glibc's sys/wait.h and stdlib.h both define various wait-related constants,
+ * depending on __USE_XOPEN(2K8) and if the other header has been included.
+ * Since they each probe the other's include guard to determine that, there is
+ * a window between a header defining its include guard and checking for the
+ * other's within which, if the other is included for the first time, they both
+ * believe the other has already defined the relevant macros etc, and so
+ * neither ends up doing so. This was not previously hit, and is still not hit
+ * when using glibc normally (though seems extremely fragile). However, as of
+ * glibc 2.34, signal.h, included by sys/wait, includes a new bits/sigstksz,
+ * which in turn includes unistd.h (when _SC_SIGSTKSZ_SOURCE is defined, which
+ * is implied by _GNU_SOURCE), which we wrap and include stdlib.h from,
+ * creating the exact aforementioned situation that breaks. Thus, forcefully
+ * include stdlib.h first whenever sys/wait.h is as a workaround, since that
+ * way round still works.
+ */
#include <stdlib.h>
#include_next <sys/wait.h>