Add the flag `--tail-merge-strings` to enable tail merging of cstrings.
For example, if we have strings `mystring\0` and `ring\0`, we could
place `mystring\0` at address `0x1000` and `ring\0` at address `0x1004`
and have them share the same underlying data.
It turns out that many ObjC method names can be tail merged. For
example, `error:` and `doFoo:error:`. On a large iOS binary, we saw
nearly a 15% size improvement in the `__TEXT__objc_methname` section and
negligible impact on link time.
```
$ bloaty --domain=vm merged.o.stripped -- base.o.stripped
VM SIZE
--------------
+95% +5.85Ki [__TEXT]
-2.4% -239Ki __TEXT,__cstring
-14.5% -710Ki __TEXT,__objc_methname
-1.0% -944Ki TOTAL
```
Tail merging for MachO was originally removed in
7c269db779.
The previous implementation used `StringTableBuilder`, but that was
removed in
4308f031cd
to ensure deduplicated strings are aligned correctly. This
implementation ensures that tail merged strings are also aligned
correctly.
Special thanks to nocchijiang for pointing this out in
https://github.com/llvm/llvm-project/pull/158720#issuecomment-3310416030.
Depends on https://github.com/llvm/llvm-project/pull/161253.
57 lines
1.6 KiB
ReStructuredText
57 lines
1.6 KiB
ReStructuredText
.. If you want to modify sections/contents permanently, you should modify both
|
|
ReleaseNotes.rst and ReleaseNotesTemplate.txt.
|
|
|
|
===========================
|
|
lld |release| Release Notes
|
|
===========================
|
|
|
|
.. contents::
|
|
:local:
|
|
|
|
.. only:: PreRelease
|
|
|
|
.. warning::
|
|
These are in-progress notes for the upcoming LLVM |release| release.
|
|
Release notes for previous releases can be found on
|
|
`the Download Page <https://releases.llvm.org/download.html>`_.
|
|
|
|
Introduction
|
|
============
|
|
|
|
This document contains the release notes for the lld linker, release |release|.
|
|
Here we describe the status of lld, including major improvements
|
|
from the previous release. All lld releases may be downloaded
|
|
from the `LLVM releases web site <https://llvm.org/releases/>`_.
|
|
|
|
Non-comprehensive list of changes in this release
|
|
=================================================
|
|
|
|
ELF Improvements
|
|
----------------
|
|
|
|
* ``--print-gc-sections=<file>`` prints garbage collection section listing to a file.
|
|
(`#159706 <https://github.com/llvm/llvm-project/pull/159706>`_)
|
|
|
|
Breaking changes
|
|
----------------
|
|
|
|
COFF Improvements
|
|
-----------------
|
|
|
|
MinGW Improvements
|
|
------------------
|
|
|
|
MachO Improvements
|
|
------------------
|
|
|
|
* ``--separate-cstring-literal-sections`` emits cstring literal sections into sections defined by their section name.
|
|
(`#158720 <https://github.com/llvm/llvm-project/pull/158720>`_)
|
|
* ``--tail-merge-strings`` enables tail merging of cstring literals.
|
|
(`#161262 <https://github.com/llvm/llvm-project/pull/161262>`_)
|
|
|
|
WebAssembly Improvements
|
|
------------------------
|
|
|
|
Fixes
|
|
#####
|