New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 810154 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Task

Blocked on:
issue 792131



Sign in to add a comment

Enable linker string tail merging

Project Member Reported by p...@chromium.org, Feb 7 2018

Issue description

We should set the linker opt level to -O2 so that we can use string tail merging in gold and lld. This reduced the size of libmonochrome.so by 150KB.

String tail merging is currently not a feature of link.exe, but we've also been thinking about how to implement this feature in the COFF version of lld.
 

Comment 1 by p...@chromium.org, Feb 7 2018

Description: Show this description
Components: Build
Labels: -Type-Bug Type-Task
Labels: Performance-Size
Project Member

Comment 4 by bugdroid1@chromium.org, Feb 8 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c9ee8b32a9740805d519c57cef154c9d30b7db98

commit c9ee8b32a9740805d519c57cef154c9d30b7db98
Author: Peter Collingbourne <pcc@chromium.org>
Date: Thu Feb 08 02:28:38 2018

build: Increase linker optimization level to -O2.

This enables string tail merge optimization in gold and lld.
It decreased the size of an official build of libmonochrome.so
by 150KB.

Bug: 810154
Change-Id: I69a6446a2dfccbe0b438477661087524bf1018e9
Reviewed-on: https://chromium-review.googlesource.com/907635
Reviewed-by: agrieve <agrieve@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535268}
[modify] https://crrev.com/c9ee8b32a9740805d519c57cef154c9d30b7db98/build/config/compiler/BUILD.gn

Comment 5 by p...@chromium.org, Mar 2 2018

I've attached a prototype patch that implements string tail merging in COFF lld. Here's the effect on binary size in an official build:

Without tail merging:
02/28/2018  07:32 PM        75,499,008 chrome_child0.dll
03/02/2018  03:40 PM        52,397,568 chrome0.dll

With tail merging:
02/28/2018  07:33 PM        75,318,784 chrome_child1.dll
03/02/2018  03:41 PM        52,308,480 chrome1.dll

So that's about 270KB saved overall.
0001-string-tail-merging.patch
7.0 KB Download

Comment 6 by ruiu@google.com, Mar 14 2018

Could you send this patch for review?

Comment 7 by p...@chromium.org, Mar 14 2018

It's still a little prototypish, so I haven't sent it for review yet. I'll try to do that soon.

Comment 9 by p...@chromium.org, Mar 15 2018

Blockedon: 817298

Comment 10 by p...@chromium.org, Mar 15 2018

r327668

Comment 11 by p...@chromium.org, Mar 20 2018

Blockedon: -817298 792131
The roll landed, so this is now blocked on switching to lld on Windows.
Labels: -OS-Android
Status: Available (was: Untriaged)
Removing Android label since this is now done on Android

Comment 13 by p...@chromium.org, Apr 3 2018

Labels: -OS-Linux
It's also done on Linux.

Comment 14 by ebra...@gnu.org, Jun 1 2018

As https://chromium-review.googlesource.com/c/chromium/src/+/907635 there is nothing to do on Windows but is macOS/iOS OK? If so this can be closed I guess.

Comment 15 by p...@chromium.org, Jun 1 2018

We had to disable string tail merging on Windows because it regressed compressed binary size (see https://bugs.chromium.org/p/chromium/issues/detail?id=838449#c24). I'd still like to re-enable it on Windows by figuring out a way to avoid the regression.

Sign in to add a comment