aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2015-06-24 04:36:52 +0000
committerRui Ueyama <ruiu@google.com>2015-06-24 04:36:52 +0000
commitddf71fc3708b9187fdfb38b086b1ee0d4e98825c (patch)
tree4bf5cf7990a7c1986188d51de50b01b0ce854d29 /llvm/lib/Object/MachOObjectFile.cpp
parent50165ffdee8b2be80b1dfc2b439c0131fb943958 (diff)
downloadllvm-ddf71fc3708b9187fdfb38b086b1ee0d4e98825c.zip
llvm-ddf71fc3708b9187fdfb38b086b1ee0d4e98825c.tar.gz
llvm-ddf71fc3708b9187fdfb38b086b1ee0d4e98825c.tar.bz2
COFF: Initial implementation of Identical COMDAT Folding.
Identical COMDAT Folding (ICF) is an optimization to reduce binary size by merging COMDAT sections that contain the same metadata, actual data and relocations. MSVC link.exe and many other linkers have this feature. LLD achieves on per with MSVC in terms produced binary size with this patch. This technique is pretty effective. For example, LLD's size is reduced from 64MB to 54MB by enaling this optimization. The algorithm implemented in this patch is extremely inefficient. It puts all COMDAT sections into a set to identify duplicates. Time to self-link with/without ICF are 3.3 and 320 seconds, respectively. So this option roughly makes LLD 100x slower. But it's okay as I wanted to achieve correctness first. LLD is still able to link itself with this optimization. I'm going to make it more efficient in followup patches. Note that this optimization is *not* entirely safe. C/C++ require different functions have different addresses. If your program relies on that property, your program wouldn't work with ICF. However, it's not going to be an issue on Windows because MSVC link.exe turns ICF on by default. As long as your program works with default settings (or not passing /opt:noicf), your program would work with LLD too. llvm-svn: 240519
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions