Shrink chrome_elf.dll by switching source_sets to static_library
Investigation of why official chrome_elf.dll builds were 86,016 bytes
larger on gn than gyp showed that encryption functions such as
aesni_cbc_encrypt were being pulled in. Deleting the implementations
of these functions from the .asm file caused no errors which proved that
the functions weren't being referenced, they just weren't being
discarded. Changing the yasm_assemble template to use static_library
fixed that and made the file sizes identical.
Comparison of the dia2dump -p output after that change showed there were
still two extra symbols in the gn builds:
class breakpad::CrashKeysWin * breakpad::CrashKeysWin::keeper_
keeper_ is a global variable - those are harder to discard, even with
/Gw - but making its source file part of a static_library fixed it.
link /verbose showed that __aullrem is pulled in by an object file that
is then discarded but I decided that following that trail wasn't worth
it. The file sizes are identical and dumpbin /headers shows that the
.text sections virtual size is just 96 bytes larger in the gn case.
Additional changes of source set to static_library may address the
remaining diffs, but they are not large enough to matter.
TL;DR The linker tries to discard unreferenced symbols but it is not
perfect at doing it, even with /Gw and /Gy. Assembly functions may be
difficult also. Use source_set with care.