summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2023-05-23 14:58:54 -0400
committerSolomon Peachy <pizza@shaftnet.org>2023-05-23 15:57:00 -0400
commit3acd5f86e59586e45cc1ec2bc25cc662a8488d6f (patch)
tree9c5451d0c140cb3bacddca1694e6fc6ea8673cc8
parent56fe1129da1b59eea4cac351707bc9eaabfb853c (diff)
downloadrockbox-3acd5f86e5.tar.gz
rockbox-3acd5f86e5.zip
build: Fix problems compiling old glibc with gmake >= 4.4
Three separate problems: 1) Make 4.4 defaults to a named pipe for jobserver control, this was incompatible with how glibc did recursive makes 2) Make 4.4 passed long arguments ( --foo ) into MAKEFLAGS and this broke stuff that wasn't expecting it 3) Circular dependency in a header generation due do make 4.4 being stricter/more consistent in how it orders rules vs which makefiles they came from. This one was the real !@#!@ to deal with. This patch set fixes the hosted arm (glibc 2.19) and mips (glibc 2.25) toolchains. Change-Id: Ie6d6a0ab7e1b36f24c43e524fee4afc0bd3a14d6
-rwxr-xr-xtools/rockboxdev.sh38
-rw-r--r--tools/toolchain-patches/glibc-220-make44.patch224
-rw-r--r--tools/toolchain-patches/glibc-225-make44.patch228
3 files changed, 484 insertions, 6 deletions
diff --git a/tools/rockboxdev.sh b/tools/rockboxdev.sh
index 475977c46f..5c71589148 100755
--- a/tools/rockboxdev.sh
+++ b/tools/rockboxdev.sh
@@ -29,8 +29,12 @@ else
make="make"
fi
+# record version
+makever=`$make -v |sed -n '1p' | sed -e 's/.* \([0-9]*\)\.\([0-9]*\).*/\1\2/'`
+
# This is the absolute path to where the script resides.
rockboxdevdir="$( readlink -f "$( dirname "${BASH_SOURCE[0]}" )" )"
+patch_dir="$rockboxdevdir/toolchain-patches"
if [ `uname -s` = "Darwin" ]; then
parallel=`sysctl -n hw.physicalcpu`
@@ -51,7 +55,7 @@ if [ -z $LINUX_MIRROR ] ; then
fi
# These are the tools this script requires and depends upon.
-reqtools="gcc g++ xz bzip2 gzip make patch makeinfo automake libtool autoconf flex bison"
+reqtools="gcc g++ xz bzip2 gzip $make patch makeinfo automake libtool autoconf flex bison"
##############################################################################
# Functions:
@@ -427,8 +431,6 @@ build() {
mkdir -p $builddir
fi
- patch_dir="$rockboxdevdir/toolchain-patches"
-
# download source tarball
gettool "$toolname" "$version"
file="$toolname-$version"
@@ -530,6 +532,8 @@ build_linux_toolchain () {
linux_ver="$6"
glibc_ver="$7"
glibc_opts="$8"
+ glibc_patches="$9"
+
# where to put the sysroot
sysroot="$prefix/$target/sysroot"
# extract arch from target
@@ -553,6 +557,11 @@ build_linux_toolchain () {
mkdir -p $builddir
fi
+ if [ "$makever" -gt 43 ] ; then
+ glibc_make_opts="--jobserver-style=pipe --shuffle=none"
+# MAKEFLAGS="--jobserver-style=pipe --shuffle=none"
+ fi
+
# download all tools
gettool "binutils" "$binutils_ver"
gettool "gcc" "$gcc_ver"
@@ -566,6 +575,18 @@ build_linux_toolchain () {
extract "linux-$linux_ver"
extract "glibc-$glibc_ver"
+ # do we have a patch?
+ for p in $glibc_patches; do
+ echo "ROCKBOXDEV: applying patch $p"
+ (cd $builddir/glibc-$glibc_ver ; patch -p1 < "$patch_dir/$p")
+
+ # check if the patch applied cleanly
+ if [ $? -gt 0 ]; then
+ echo "ROCKBOXDEV: failed to apply patch $p"
+ exit
+ fi
+ done
+
# we make it possible to restart a build on error by using the RBDEV_RESTART
# variable, the format is RBDEV_RESTART="tool" where tool is the toolname at which
# to restart (binutils, gcc)
@@ -600,7 +621,7 @@ build_linux_toolchain () {
prefix="/usr" \
buildtool "glibc" "$glibc_ver" "--target=$target --host=$target --build=$MACHTYPE \
--with-__thread --with-headers=$sysroot/usr/include $glibc_opts" \
- "" "install install_root=$sysroot"
+ "$glibc_make_opts" "install install_root=$sysroot"
# build stage 2 compiler
RESTART_STEP="gcc-stage2" \
buildtool "gcc" "$gcc_ver" "$gcc_opts --enable-languages=c,c++ --target=$target \
@@ -674,6 +695,11 @@ if [ -n "$missingtools" ]; then
exit 1
fi
+if ! $make -v | grep -q GNU ; then
+ echo "ROCKBOXDEV: Building the rockbox toolchains requires GNU Make."
+ exit 1
+fi
+
dlwhere=$(readlink -f "$dlwhere")
prefix=$(readlink -f "$prefix")
builddir=$(readlink -f "$builddir")
@@ -789,7 +815,7 @@ do
# avoid patches/bugs.
glibcopts="--enable-kernel=2.6.23 --enable-oldest-abi=2.4"
build_linux_toolchain "arm-rockbox-linux-gnueabi" "2.26.1" "" "4.9.4" \
- "$gccopts" "2.6.32.68" "2.19" "$glibcopts"
+ "$gccopts" "2.6.32.68" "2.19" "$glibcopts" "glibc-220-make44.patch"
# build alsa-lib
# we need to set the prefix to how it is on device (/usr) and then
# tweak install dir at make install step
@@ -825,7 +851,7 @@ do
glibcopts="--enable-kernel=3.2 --enable-oldest-abi=2.16"
# FIXME: maybe add -mhard-float
build_linux_toolchain "mipsel-rockbox-linux-gnu" "2.26.1" "" "4.9.4" \
- "$gccopts" "3.2.85" "2.25" "$glibcopts"
+ "$gccopts" "3.2.85" "2.25" "$glibcopts" "glibc-225-make44.patch"
# build alsa-lib
# we need to set the prefix to how it is on device (/usr) and then
# tweak install dir at make install step
diff --git a/tools/toolchain-patches/glibc-220-make44.patch b/tools/toolchain-patches/glibc-220-make44.patch
new file mode 100644
index 0000000000..6370acea80
--- /dev/null
+++ b/tools/toolchain-patches/glibc-220-make44.patch
@@ -0,0 +1,224 @@
+diff -Naur glibc-2.20/libio/stdio.h glibc-2.20-patched/libio/stdio.h
+--- glibc-2.20/libio/stdio.h 2014-09-07 04:09:09.000000000 -0400
++++ glibc-2.20-patched/libio/stdio.h 2023-05-23 14:44:22.278872059 -0400
+@@ -151,18 +151,23 @@
+ # define P_tmpdir "/tmp"
+ #endif
+
++#define L_tmpnam 20
++#define TMP_MAX 238328
+
+ /* Get the values:
+- L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
+- TMP_MAX The minimum number of unique filenames generated by tmpnam
+- (and tempnam when it uses tmpnam's name space),
+- or tempnam (the two are separate).
+- L_ctermid How long an array to pass to `ctermid'.
+- L_cuserid How long an array to pass to `cuserid'.
+- FOPEN_MAX Minimum number of files that can be open at once.
+ FILENAME_MAX Maximum length of a filename. */
+ #include <bits/stdio_lim.h>
+
++#ifdef __USE_POSIX
++# define L_ctermid 9
++# if !defined __USE_XOPEN2K || defined __USE_GNU
++# define L_cuserid 9
++# endif
++#endif
++
++#undef FOPEN_MAX
++#define FOPEN_MAX 16
++
+
+ /* Standard streams. */
+ extern struct _IO_FILE *stdin; /* Standard input stream. */
+diff -Naur glibc-2.20/Makerules glibc-2.20-patched/Makerules
+--- glibc-2.20/Makerules 2014-09-07 04:09:09.000000000 -0400
++++ glibc-2.20-patched/Makerules 2023-05-23 14:42:21.745795149 -0400
+@@ -1277,54 +1277,6 @@
+
+ endif
+
+-# These will have been set by sysdeps/posix/Makefile.
+-L_tmpnam ?= 1
+-TMP_MAX ?= 0
+-L_ctermid ?= 1
+-L_cuserid ?= 1
+-
+-stdio_lim = $(common-objpfx)bits/stdio_lim.h
+-
+-$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @:
+-$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
+- $(common-objpfx)config.make
+- $(make-target-directory)
+- { echo '#include "$(..)posix/bits/posix1_lim.h"'; \
+- echo '#define _LIBC 1'; \
+- echo '#include "$(..)misc/sys/uio.h"'; } | \
+- $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \
+- $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT)
+- sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
+- $(@:st=dT) > $(@:st=dt)
+- mv -f $(@:st=dt) $(@:st=d)
+- fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \
+- filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \
+- iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \
+- fopen_max=$${fopen_max:-16}; \
+- filename_max=$${filename_max:-1024}; \
+- if [ -z "$$iov_max" ]; then \
+- define_iov_max="# undef IOV_MAX"; \
+- else \
+- define_iov_max="# define IOV_MAX $$iov_max"; \
+- fi; \
+- sed -e "s/@FOPEN_MAX@/$$fopen_max/" \
+- -e "s/@FILENAME_MAX@/$$filename_max/" \
+- -e "s/@L_tmpnam@/$(L_tmpnam)/" \
+- -e "s/@TMP_MAX@/$(TMP_MAX)/" \
+- -e "s/@L_ctermid@/$(L_ctermid)/" \
+- -e "s/@L_cuserid@/$(L_cuserid)/" \
+- -e "s/@define_IOV_MAX@/$$define_iov_max/" \
+- $< > $(@:st=h.new)
+- $(move-if-change) $(@:st=h.new) $(@:st=h)
+-# Remove these last so that they can be examined if something went wrong.
+- rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt)
+- touch $@
+-# Get dependencies.
+-ifndef no_deps
+--include $(stdio_lim:h=d)
+-endif
+-common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st
+-
+ FORCE:
+
+ .PHONY: echo-headers
+diff -Naur glibc-2.20/Rules glibc-2.20-patched/Rules
+--- glibc-2.20/Rules 2014-09-07 04:09:09.000000000 -0400
++++ glibc-2.20-patched/Rules 2023-05-23 14:44:22.279872060 -0400
+@@ -60,9 +60,6 @@
+ common-generated :=
+ endif
+
+-# See below. This must be set before Makerules processes it.
+-before-compile += $(common-objpfx)bits/stdio_lim.h
+-
+ include $(..)Makerules
+
+ .PHONY: subdir_lib
+diff -Naur glibc-2.20/stdio-common/stdio_lim.h.in glibc-2.20-patched/stdio-common/stdio_lim.h.in
+--- glibc-2.20/stdio-common/stdio_lim.h.in 2014-09-07 04:09:09.000000000 -0400
++++ glibc-2.20-patched/stdio-common/stdio_lim.h.in 1969-12-31 19:00:00.000000000 -0500
+@@ -1,42 +0,0 @@
+-/* Copyright (C) 1994-2014 Free Software Foundation, Inc.
+- This file is part of the GNU C Library.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Lesser General Public
+- License as published by the Free Software Foundation; either
+- version 2.1 of the License, or (at your option) any later version.
+-
+- The GNU C Library is distributed in the hope that it will be useful,
+- but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- Lesser General Public License for more details.
+-
+- You should have received a copy of the GNU Lesser General Public
+- License along with the GNU C Library; if not, see
+- <http://www.gnu.org/licenses/>. */
+-
+-#if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX
+-# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
+-#endif
+-
+-#ifdef _STDIO_H
+-# define L_tmpnam @L_tmpnam@
+-# define TMP_MAX @TMP_MAX@
+-# define FILENAME_MAX @FILENAME_MAX@
+-
+-# ifdef __USE_POSIX
+-# define L_ctermid @L_ctermid@
+-# if !defined __USE_XOPEN2K || defined __USE_GNU
+-# define L_cuserid @L_cuserid@
+-# endif
+-# endif
+-#endif
+-
+-#if defined __need_FOPEN_MAX || defined _STDIO_H
+-# undef FOPEN_MAX
+-# define FOPEN_MAX @FOPEN_MAX@
+-#endif
+-
+-#if defined __need_IOV_MAX && !defined IOV_MAX
+-@define_IOV_MAX@
+-#endif
+diff -Naur glibc-2.20/sysdeps/mach/hurd/bits/stdio_lim.h glibc-2.20-patched/sysdeps/mach/hurd/bits/stdio_lim.h
+--- glibc-2.20/sysdeps/mach/hurd/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.20-patched/sysdeps/mach/hurd/bits/stdio_lim.h 2023-05-23 14:44:22.279872060 -0400
+@@ -0,0 +1,28 @@
++/* System specific stdio.h definitions. Hurd version.
++ Copyright (C) 2023 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _BITS_STDIO_LIM_H
++#define _BITS_STDIO_LIM_H 1
++
++#ifndef _STDIO_H
++# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
++#endif
++
++#define FILENAME_MAX 1024
++
++#endif /* bits/stdio_lim.h */
+diff -Naur glibc-2.20/sysdeps/posix/Makefile glibc-2.20-patched/sysdeps/posix/Makefile
+--- glibc-2.20/sysdeps/posix/Makefile 2014-09-07 04:09:09.000000000 -0400
++++ glibc-2.20-patched/sysdeps/posix/Makefile 1969-12-31 19:00:00.000000000 -0500
+@@ -1,5 +0,0 @@
+-# These affect the generated bits/stdio_lim.h file.
+-L_tmpnam = 20
+-TMP_MAX = 238328
+-L_ctermid = 9
+-L_cuserid = 9
+diff -Naur glibc-2.20/sysdeps/unix/sysv/linux/bits/stdio_lim.h glibc-2.20-patched/sysdeps/unix/sysv/linux/bits/stdio_lim.h
+--- glibc-2.20/sysdeps/unix/sysv/linux/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.20-patched/sysdeps/unix/sysv/linux/bits/stdio_lim.h 2023-05-23 14:44:22.279872060 -0400
+@@ -0,0 +1,28 @@
++/* System specific stdio.h definitions. Linux version.
++ Copyright (C) 2023 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <https://www.gnu.org/licenses/>. */
++
++#ifndef _BITS_STDIO_LIM_H
++#define _BITS_STDIO_LIM_H 1
++
++//#ifndef _STDIO_H
++//# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
++//#endif
++
++#define FILENAME_MAX 4096
++
++#endif /* bits/stdio_lim.h */
diff --git a/tools/toolchain-patches/glibc-225-make44.patch b/tools/toolchain-patches/glibc-225-make44.patch
new file mode 100644
index 0000000000..45d4e9c621
--- /dev/null
+++ b/tools/toolchain-patches/glibc-225-make44.patch
@@ -0,0 +1,228 @@
+diff -Naur glibc-2.25/libio/stdio.h glibc-2.25-patched/libio/stdio.h
+--- glibc-2.25/libio/stdio.h 2017-02-05 10:28:43.000000000 -0500
++++ glibc-2.25-patched/libio/stdio.h 2023-05-23 15:22:27.482980335 -0400
+@@ -154,18 +154,23 @@
+ # define P_tmpdir "/tmp"
+ #endif
+
++#define L_tmpnam 20
++#define TMP_MAX 238328
+
+ /* Get the values:
+- L_tmpnam How long an array of chars must be to be passed to `tmpnam'.
+- TMP_MAX The minimum number of unique filenames generated by tmpnam
+- (and tempnam when it uses tmpnam's name space),
+- or tempnam (the two are separate).
+- L_ctermid How long an array to pass to `ctermid'.
+- L_cuserid How long an array to pass to `cuserid'.
+- FOPEN_MAX Minimum number of files that can be open at once.
+ FILENAME_MAX Maximum length of a filename. */
+ #include <bits/stdio_lim.h>
+
++#ifdef __USE_POSIX
++# define L_ctermid 9
++# if !defined __USE_XOPEN2K || defined __USE_GNU
++# define L_cuserid 9
++# endif
++#endif
++
++#undef FOPEN_MAX
++#define FOPEN_MAX 16
++
+
+ /* Standard streams. */
+ extern struct _IO_FILE *stdin; /* Standard input stream. */
+diff -Naur glibc-2.25/Makerules glibc-2.25-patched/Makerules
+--- glibc-2.25/Makerules 2017-02-05 10:28:43.000000000 -0500
++++ glibc-2.25-patched/Makerules 2023-05-23 15:22:05.594967548 -0400
+@@ -1474,55 +1474,7 @@
+ endif
+
+ endif
+-
+-# These will have been set by sysdeps/posix/Makefile.
+-L_tmpnam ?= 1
+-TMP_MAX ?= 0
+-L_ctermid ?= 1
+-L_cuserid ?= 1
+
+-stdio_lim = $(common-objpfx)bits/stdio_lim.h
+-
+-$(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @:
+-$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
+- $(common-objpfx)config.make
+- $(make-target-directory)
+- { echo '#include "$(..)posix/bits/posix1_lim.h"'; \
+- echo '#define _LIBC 1'; \
+- echo '#include "$(..)misc/sys/uio.h"'; } | \
+- $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \
+- $(CPPUNDEFS) $(+includes) -xc - -o $(@:st=hT)
+- sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
+- $(@:st=dT) > $(@:st=dt)
+- mv -f $(@:st=dt) $(@:st=d)
+- fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \
+- filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \
+- iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \
+- fopen_max=$${fopen_max:-16}; \
+- filename_max=$${filename_max:-1024}; \
+- if [ -z "$$iov_max" ]; then \
+- define_iov_max="# undef IOV_MAX"; \
+- else \
+- define_iov_max="# define IOV_MAX $$iov_max"; \
+- fi; \
+- sed -e "s/@FOPEN_MAX@/$$fopen_max/" \
+- -e "s/@FILENAME_MAX@/$$filename_max/" \
+- -e "s/@L_tmpnam@/$(L_tmpnam)/" \
+- -e "s/@TMP_MAX@/$(TMP_MAX)/" \
+- -e "s/@L_ctermid@/$(L_ctermid)/" \
+- -e "s/@L_cuserid@/$(L_cuserid)/" \
+- -e "s/@define_IOV_MAX@/$$define_iov_max/" \
+- $< > $(@:st=h.new)
+- $(move-if-change) $(@:st=h.new) $(@:st=h)
+-# Remove these last so that they can be examined if something went wrong.
+- rm -f $(@:st=hT) $(@:st=dT) $(@:st=dt)
+- touch $@
+-# Get dependencies.
+-ifndef no_deps
+--include $(stdio_lim:h=d)
+-endif
+-common-generated += bits/stdio_lim.h bits/stdio_lim.d bits/stdio_lim.st
+-
+ FORCE:
+
+ .PHONY: echo-headers
+diff -Naur glibc-2.25/Rules glibc-2.25-patched/Rules
+--- glibc-2.25/Rules 2017-02-05 10:28:43.000000000 -0500
++++ glibc-2.25-patched/Rules 2023-05-23 15:22:27.482980335 -0400
+@@ -60,9 +60,6 @@
+ common-generated :=
+ endif
+
+-# See below. This must be set before Makerules processes it.
+-before-compile += $(common-objpfx)bits/stdio_lim.h
+-
+ include $(..)Makerules
+
+ .PHONY: subdir_lib
+diff -Naur glibc-2.25/stdio-common/stdio_lim.h.in glibc-2.25-patched/stdio-common/stdio_lim.h.in
+--- glibc-2.25/stdio-common/stdio_lim.h.in 2017-02-05 10:28:43.000000000 -0500
++++ glibc-2.25-patched/stdio-common/stdio_lim.h.in 1969-12-31 19:00:00.000000000 -0500
+@@ -1,42 +0,0 @@
+-/* Copyright (C) 1994-2017 Free Software Foundation, Inc.
+- This file is part of the GNU C Library.
+-
+- The GNU C Library is free software; you can redistribute it and/or
+- modify it under the terms of the GNU Lesser General Public
+- License as published by the Free Software Foundation; either
+- version 2.1 of the License, or (at your option) any later version.
+-
+- The GNU C Library is distributed in the hope that it will be useful,
+- but WITHOUT ANY WARRANTY; without even the implied warranty of
+- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+- Lesser General Public License for more details.
+-
+- You should have received a copy of the GNU Lesser General Public
+- License along with the GNU C Library; if not, see
+- <http://www.gnu.org/licenses/>. */
+-
+-#if !defined _STDIO_H && !defined __need_FOPEN_MAX && !defined __need_IOV_MAX
+-# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
+-#endif
+-
+-#ifdef _STDIO_H
+-# define L_tmpnam @L_tmpnam@
+-# define TMP_MAX @TMP_MAX@
+-# define FILENAME_MAX @FILENAME_MAX@
+-
+-# ifdef __USE_POSIX
+-# define L_ctermid @L_ctermid@
+-# if !defined __USE_XOPEN2K || defined __USE_GNU
+-# define L_cuserid @L_cuserid@
+-# endif
+-# endif
+-#endif
+-
+-#if defined __need_FOPEN_MAX || defined _STDIO_H
+-# undef FOPEN_MAX
+-# define FOPEN_MAX @FOPEN_MAX@
+-#endif
+-
+-#if defined __need_IOV_MAX && !defined IOV_MAX
+-@define_IOV_MAX@
+-#endif
+diff -Naur glibc-2.25/sysdeps/mach/hurd/bits/stdio_lim.h glibc-2.25-patched/sysdeps/mach/hurd/bits/stdio_lim.h
+--- glibc-2.25/sysdeps/mach/hurd/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.25-patched/sysdeps/mach/hurd/bits/stdio_lim.h 2023-05-23 15:22:27.483980336 -0400
+@@ -0,0 +1,28 @@
++/* System specific stdio.h definitions. Hurd version.
++ Copyright (C) 2023 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <http://www.gnu.org/licenses/>. */
++
++#ifndef _BITS_STDIO_LIM_H
++#define _BITS_STDIO_LIM_H 1
++
++#ifndef _STDIO_H
++# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
++#endif
++
++#define FILENAME_MAX 1024
++
++#endif /* bits/stdio_lim.h */
+diff -Naur glibc-2.25/sysdeps/posix/Makefile glibc-2.25-patched/sysdeps/posix/Makefile
+--- glibc-2.25/sysdeps/posix/Makefile 2017-02-05 10:28:43.000000000 -0500
++++ glibc-2.25-patched/sysdeps/posix/Makefile 2023-05-23 15:22:27.483980336 -0400
+@@ -1,8 +1,3 @@
+-# These affect the generated bits/stdio_lim.h file.
+-L_tmpnam = 20
+-TMP_MAX = 238328
+-L_ctermid = 9
+-L_cuserid = 9
+
+ ifeq ($(subdir)|$(have-thread-library),rt|no)
+ # With NPTL, this lives in libpthread so it can be used for sem_open too.
+diff -Naur glibc-2.25/sysdeps/unix/sysv/linux/bits/stdio_lim.h glibc-2.25-patched/sysdeps/unix/sysv/linux/bits/stdio_lim.h
+--- glibc-2.25/sysdeps/unix/sysv/linux/bits/stdio_lim.h 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.25-patched/sysdeps/unix/sysv/linux/bits/stdio_lim.h 2023-05-23 15:22:27.483980336 -0400
+@@ -0,0 +1,28 @@
++/* System specific stdio.h definitions. Linux version.
++ Copyright (C) 2023 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, see
++ <https://www.gnu.org/licenses/>. */
++
++#ifndef _BITS_STDIO_LIM_H
++#define _BITS_STDIO_LIM_H 1
++
++//#ifndef _STDIO_H
++//# error "Never include <bits/stdio_lim.h> directly; use <stdio.h> instead."
++//#endif
++
++#define FILENAME_MAX 4096
++
++#endif /* bits/stdio_lim.h */