This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [patch ld]: Increase stack size to be 10 MB by default
On Sat, 7 Jun 2008, Brian Dessent wrote:
> Kai Tietz wrote:
>
> > * emultempl/pep.em (init): Reserved stack size
> > defaults to 10 MB.
>
> This used to default to 32MB, but it was reduced to 2MB because of the
> concern that in multi-threaded apps every thread gets a stack of this
> size by default:
> <http://sourceware.org/ml/binutils/2001-06/msg00054.html>. I understand
> that the problem is that some gcc files or testcases require a larger
> stack, but shouldn't that be handled in gcc and not by changing the
> defaults of the linker? I just verified that the Microsoft Visual
> Studio 2005 linker does default to 1MB StackReserve as stated in that
> message.
FWIW, we have the following local GCC patch at CodeSourcery to increase
the stack limit to 8MB for Windows-hosted compilers, but weren't sure
about upstream acceptability, especially since changing config/mh-mingw
affects all tools built from the src repository, not just GCC. I suppose
at least none of these tools are multi-threaded.
config:
2008-05-05 Joseph Myers <joseph@codesourcery.com>
* config/mh-mingw (LDFLAGS): Define.
gcc:
2008-05-05 Joseph Myers <joseph@codesourcery.com>
* configure.ac: Use empty LDFLAGS when running configure for the
build system.
* configure: Regenerate.
* Makefile.in (BUILD_LDFLAGS): Do not define to $(LDFLAGS) unless
host == build.
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 206790)
+++ gcc/configure.ac (revision 206791)
@@ -1483,7 +1483,7 @@
*) realsrcdir=../${srcdir};;
esac
saved_CFLAGS="${CFLAGS}"
- CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
+ CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" LDFLAGS="" \
${realsrcdir}/configure \
--enable-languages=${enable_languages-all} \
--target=$target_alias --host=$build_alias --build=$build_alias
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in (revision 206790)
+++ gcc/Makefile.in (revision 206791)
@@ -689,7 +689,11 @@
BUILD_CFLAGS= @BUILD_CFLAGS@ -DGENERATOR_FILE
# Native linker and preprocessor flags. For x-fragment overrides.
+ifeq ($(host),$(build))
BUILD_LDFLAGS=$(LDFLAGS)
+else
+BUILD_LDFLAGS=
+endif
BUILD_CPPFLAGS=$(ALL_CPPFLAGS)
# Actual name to use when installing a native compiler.
Index: config/mh-mingw
===================================================================
--- config/mh-mingw (revision 206790)
+++ config/mh-mingw (revision 206791)
@@ -1,3 +1,5 @@
# Add -D__USE_MINGW_ACCESS to enable the built compiler to work on Windows
# Vista (see PR33281 for details).
BOOT_CFLAGS += -D__USE_MINGW_ACCESS
+# Increase stack limit to same as Linux default.
+LDFLAGS = -Wl,--stack,8388608
--
Joseph S. Myers
joseph@codesourcery.com