Bug 11618 - Add an option to page-align .bss
Summary: Add an option to page-align .bss
Status: WAITING
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-21 23:32 IST by Taras Glek
Modified: 2010-06-02 20:07 IST (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Taras Glek 2010-05-21 23:32:40 IST
The dynamic linker memset(0)ing .bss causes an extra pagefault due to the
kernel's COW. For firefox 10% of our cold startup page faults are caused by
memset(0)ing .bss once for every library.

One could stick prelink data, .gnu.* metadata, etc infront of .bss to minimize
executable bloat.
Comment 1 Nick Clifton 2010-05-25 16:02:07 IST
Hi Taras,

  [You did not mention which target architecture(s) you are interested in, so I
have just tested the following on an x86 host].

  There should be no need to add a new command line option to the linker. 
Instead you can make use of the existing linker script facilities.  Try this:

  % cat align_bss.ld
  . = ALIGN (CONSTANT (MAXPAGESIZE));
  INSERT BEFORE .bss;

Then just add "-Wl,-Talign_bss.ld" to the firefox final link command line.

Cheers
  Nick

Comment 2 Taras Glek 2010-06-02 20:07:25 IST
Is there also a way to page-pad .data ld.so zeros end of .data to end of mmaping.