Bug 55650 - Firefox profiledbuild: libxul.so: cannot map zero-fill pages: Cannot allocate memory
Summary: Firefox profiledbuild: libxul.so: cannot map zero-fill pages: Cannot allocat...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: gcov-profile (show other bugs)
Version: 4.7.4
: P3 normal
Target Milestone: 4.7.3
Assignee: Jakub Jelinek
URL:
Keywords:
: 59973 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-12-11 17:16 UTC by Markus Trippelsdorf
Modified: 2014-01-29 18:40 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-12-12 00:00:00


Attachments
gcc48-pr55650.patch (633 bytes, patch)
2012-12-12 08:08 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2012-12-11 17:16:57 UTC
Building Firefox with:
make -f client.mk profiledbuild

Results in:
...
/var/tmp/moz-build-dir/dist/bin/xpcshell: error while loading shared libraries: libxul.so: cannot map zero-fill pages: Cannot allocate memory
make[4]: *** [prepare-package] Error 127

 % readelf -lSW ./libxul.so
There are 41 section headers, starting at offset 0x103e7f10:
Section Headers:
  [Nr] Name              Type            Address          Off    Size   ES Flg Lk Inf Al
...
  [28] .bss              NOBITS          000000000bfaabe0 bfa9be0 80186ae8c 00  WA  0   0 32

Adding Wl,-Map,libxul.map when linking libxul shows:
...
 .bss..LPBX1    0x000000000ccb3be0 0x800000000 /var/tmp/moz-build-dir/toolkit/library/../components/protobuf/once.i_o
....

Reducing once.cpp leads to:

 % cat test.ii
class A
{
    virtual void Run ();
};
class B:public A
{
public:
    B ();
    void Run ()
    {
    }
};
void *operator     new (unsigned long)
__attribute__ ((__externally_visible__));
void *moz_xmalloc ();
inline void *operator
new (unsigned long)
{
    return moz_xmalloc ();
}

inline A *
NewCallback ()
{
    return new B;
}

 % c++ -c -fprofile-generate -fdata-sections -O2 test.ii
 % readelf -lSW ./test.o | grep "800000000"
  [11] .bss..LPBX1       NOBITS          0000000000000000 000120 800000000 00  WA  0   0 32
Comment 1 Jakub Jelinek 2012-12-12 08:08:35 UTC
Created attachment 28933 [details]
gcc48-pr55650.patch

Untested fix.
Comment 2 Jakub Jelinek 2012-12-13 10:11:47 UTC
Author: jakub
Date: Thu Dec 13 10:11:39 2012
New Revision: 194470

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194470
Log:
	PR gcov-profile/55650
	* coverage.c (coverage_obj_init): Return false if no functions
	are being emitted.

	* g++.dg/other/pr55650.C: New test.
	* g++.dg/other/pr55650.cc: New file.

Added:
    trunk/gcc/testsuite/g++.dg/other/pr55650.C
    trunk/gcc/testsuite/g++.dg/other/pr55650.cc
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/coverage.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 Jakub Jelinek 2012-12-13 10:13:14 UTC
Fixed.
Comment 4 Mike Hommey 2014-01-28 23:48:31 UTC
*** Bug 59973 has been marked as a duplicate of this bug. ***
Comment 5 Markus Trippelsdorf 2014-01-29 09:20:55 UTC
A backport to 4.7-branch looks easy and appropriate.
Jakub, can you handle this?
Comment 6 Markus Trippelsdorf 2014-01-29 18:37:15 UTC
Author: trippels
Date: Wed Jan 29 18:36:42 2014
New Revision: 207277

URL: http://gcc.gnu.org/viewcvs?rev=207277&root=gcc&view=rev
Log:
2014-01-29  Markus Trippelsdorf  <markus@trippelsdorf.de>

        Backport from mainline
        2012-12-13  Jakub Jelinek  <jakub@redhat.com>

        PR gcov-profile/55650
        * coverage.c (coverage_obj_init): Return false if no functions
        are being emitted.

        * g++.dg/other/pr55650.C: New test.
        * g++.dg/other/pr55650.cc: New file

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/other/pr55650.C
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/other/pr55650.cc
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/coverage.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Comment 7 Markus Trippelsdorf 2014-01-29 18:40:43 UTC
Fixed by backport.