This is the mail archive of the
mailing list for the GCC project.
[PATCH] Fix FAIL: 22_locale/locale/cons/12438.cc
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, libstdc++ at gcc dot gnu dot org
- Date: Mon, 4 Dec 2006 15:10:21 -0500
- Subject: [PATCH] Fix FAIL: 22_locale/locale/cons/12438.cc
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
I'm consistently getting
FAIL: 22_locale/locale/cons/12438.cc execution test
on FC6/RHEL5beta x86_64-linux but only looked into the details
why this fails there now.
The problem is that 22_locale/locale/cons/12438.cc is the only
test which calls set_memory_limit with non-default argument - 10MB
(the default is 16MB).
Binutils changed recently the default maximum ELF page size to 2MB,
while the actual page size is still 4KB, the gap between
read-only/executable and writable segments in shared libraries is
roughly 2MB because of that. On Linux (not sure what other
OSes do) the gap between the segments is mapped with PROT_NONE
mapping (to make sure other things aren't mapped in between) and
that is accounted toward the RLIMIT_AS limit.
A libstdc++-v3 non-threaded testcase usually has 4 shared
libraries plus the dynamic linker, so that's already 8MB of address
space used just by the 4 gaps and not surprisingly the remaining
2MB of address spaces aren't enough for the stack/heap/binary and DSO
text and writable segments and everything else in the address space.
The following patch makes sure RLIMIT_AS is never lower than 16MB
on x86_64-linux (that is apparently enough, none of the other
tests that call set_memory_limits with the default 16MB argument
fail and 12438.cc succeeds too with 16MB AS).
Ok for trunk/4.2/4.1?
2006-12-04 Jakub Jelinek <email@example.com>
* testsuite/util/testsuite_hooks.cc (set_memory_limits): Don't set
RLIMIT_AS below 16MB on x86_64-linux.
--- libstdc++-v3/testsuite/util/testsuite_hooks.cc 2006-06-09 14:59:13.000000000 +0200
+++ libstdc++-v3/testsuite/util/testsuite_hooks.cc 2006-12-04 17:58:14.000000000 +0100
@@ -89,6 +89,16 @@ namespace __gnu_test
// Virtual memory.
+ // On x86_64-linux, the default is -z max-page-size=0x200000
+ // which means up to 2MB of address space are accounted for
+ // PROT_NONE mappings between text and data segments of
+ // each shared library. There are 4 shared libs involved
+ // in addition to the dynamic linker. Use at least 16MB address space
+ // limit.
+#if defined(__x86_64__) && defined(__linux__)
+ if (limit < 16777216)
+ limit = 16777216;
// On HP-UX 11.23, a trivial C++ program that sets RLIMIT_AS to
// anything less than 128MB cannot "malloc" even 1K of memory.
// Therefore, we skip RLIMIT_AS on HP-UX.