This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix FAIL: 22_locale/locale/cons/


I'm consistently getting
FAIL: 22_locale/locale/cons/ 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/ 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 succeeds too with 16MB AS).

Ok for trunk/4.2/4.1?

2006-12-04  Jakub Jelinek  <>

	* testsuite/util/ (set_memory_limits): Don't set
	RLIMIT_AS below 16MB on x86_64-linux.

--- libstdc++-v3/testsuite/util/	2006-06-09 14:59:13.000000000 +0200
+++ libstdc++-v3/testsuite/util/	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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]