This is an archive of the discontinued LLVM Phabricator instance.

[COFF] don't mark lazy symbols as used in regular objects
ClosedPublic

Authored by inglorion on Sep 6 2018, 12:59 AM.

Details

Summary

r338767 updated the COFF and wasm linker SymbolTable code to be
strutured more like the ELF linker's. That inadvertedly changed the
behavior of the COFF linker so that lazy symbols would be marked as
used in regular objects. This change adds an overload of the insert()
function, similar to the ELF linker, which does not perform that
marking.

Diff Detail

Repository
rL LLVM

Event Timeline

inglorion created this revision.Sep 6 2018, 12:59 AM
inglorion added a comment.EditedSep 6 2018, 1:03 AM

Building Chromium with ThinLTO without this patch causes test_chrome_with_chromedriver.py to fail. With the patch, it runs successfully. (https://crbug.com/881036).

hans added a comment.Sep 6 2018, 1:24 AM

Is it possible to have a test for this?

inglorion updated this revision to Diff 164266.Sep 6 2018, 12:08 PM

added test

Since r338767, "foo,p" and "bar,p" show up as "foo,px" and "bar,px", indicating that they are used in regular objects. However, there are no regular (non-LTO) objects in the test. Only main should have the 'x'.

rnk accepted this revision.Sep 6 2018, 1:19 PM

lgtm, thanks!

This revision is now accepted and ready to land.Sep 6 2018, 1:19 PM
rnk added a comment.Sep 6 2018, 1:20 PM

BTW, it's possible that this is also what's causing our size regression vs. non-LTO builds. If archives add lazy symbols which are marked as being used from a regular object, that might prevent us from discarding them.

This revision was automatically updated to reflect the committed changes.

I was thinking that as well, and it did fix the size regression: from 151,548,928 to 141,140,992 bytes, where the non-LTO version is 140,072,960 bytes.