llvm-project/lld/wasm
Sam Clegg 668447677a [WebAssembly] Add a flag to control merging data segments
Merging data segments produces smaller code sizes because each segment
has some boilerplate. Therefore, merging data segments is generally the
right approach, especially with wasm where binaries are typically
delivered over the network.

However, when analyzing wasm binaries, it can be helpful to get a
conservative picture of which functions are using which data
segments[0]. Perhaps there is a large data segment that you didn't
expect to be included in the wasm, introduced by some library you're
using, and you'd like to know which library it was. In this scenario,
merging data segments only makes the analysis worse.

Alternatively, perhaps you will remove some dead functions by-hand[1]
that can't be statically proven dead by the compiler or lld, and
removing these functions might make some data garbage collect-able, and
you'd like to run `--gc-sections` again so that this now-unused data can
be collected. If the segments were originally merged, then a single use
of the merged data segment will entrench all of the data.

[0] https://github.com/rustwasm/twiggy
[1] https://github.com/fitzgen/wasm-snip

Patch by Nick Fitzgerald!

Differential Revision: https://reviews.llvm.org/D46417

llvm-svn: 332013
2018-05-10 18:23:51 +00:00
..
CMakeLists.txt [WebAssembly] Add support for --gc-sections 2018-01-31 01:45:47 +00:00
Config.h [WebAssembly] Add a flag to control merging data segments 2018-05-10 18:23:51 +00:00
Driver.cpp [WebAssembly] Add a flag to control merging data segments 2018-05-10 18:23:51 +00:00
InputChunks.cpp [WebAssembly] Only perform sanity checking of relocation targets in debug builds 2018-05-05 00:18:43 +00:00
InputChunks.h [WebAssembly] Only perform sanity checking of relocation targets in debug builds 2018-05-05 00:18:43 +00:00
InputFiles.cpp [WebAssembly] Add support for debug (DWARF) sections 2018-05-04 23:14:42 +00:00
InputFiles.h [WebAssembly] Add support for debug (DWARF) sections 2018-05-04 23:14:42 +00:00
InputGlobal.h [WebAssembly] Implement -print-gc-sections, to better test GC of globals 2018-04-20 17:28:12 +00:00
MarkLive.cpp [WebAssembly] Implement -print-gc-sections, to better test GC of globals 2018-04-20 17:28:12 +00:00
MarkLive.h Consistent (non) use of empty lines in include blocks 2018-02-20 21:53:18 +00:00
Options.td [WebAssembly] Add a flag to control merging data segments 2018-05-10 18:23:51 +00:00
OutputSections.cpp [WebAssembly] Add support for debug (DWARF) sections 2018-05-04 23:14:42 +00:00
OutputSections.h [WebAssembly] Add support for debug (DWARF) sections 2018-05-04 23:14:42 +00:00
OutputSegment.h [WebAssembly] Remove another trivial accessor. 2018-04-05 19:37:31 +00:00
SymbolTable.cpp [WebAssembly] Check function signatures by default 2018-05-05 01:23:07 +00:00
SymbolTable.h [WebAssembly] Avoid COMDAT hashmap lookup for each symbol. NFC 2018-03-14 15:45:11 +00:00
Symbols.cpp [WebAssembly] Add support for debug (DWARF) sections 2018-05-04 23:14:42 +00:00
Symbols.h [WebAssembly] Add support for debug (DWARF) sections 2018-05-04 23:14:42 +00:00
Writer.cpp [WebAssembly] Add a flag to control merging data segments 2018-05-10 18:23:51 +00:00
Writer.h
WriterUtils.cpp [WebAssembly] Add export/import for function pointer table 2018-03-27 17:38:51 +00:00
WriterUtils.h [WebAssembly] Add export/import for function pointer table 2018-03-27 17:38:51 +00:00