[lld-macho] Emit REBASE_OPCODE_ADD_ADDR_IMM_SCALED if possible
authorDaniel Bertalan <dani@danielbertalan.dev>
Wed, 29 Jun 2022 09:33:41 +0000 (11:33 +0200)
committerDaniel Bertalan <dani@danielbertalan.dev>
Wed, 29 Jun 2022 20:28:39 +0000 (22:28 +0200)
commit8d29f0fdb9c64087687ac80074876d47b16efeab
tree32af8bdaf04dc29e3e8a19c55c43e13fe0134d15
parent017c068f7899b895e654c8efc1c4d02d940dbf8a
[lld-macho] Emit REBASE_OPCODE_ADD_ADDR_IMM_SCALED if possible

An ADD_ADDR rebase opcode's argument can be encoded as an immediate if
the offset is less than 15 * word size. This change reduces the size of
chromium_framework by 100+ KiB.

Differential Revision: https://reviews.llvm.org/D128798
lld/MachO/SyntheticSections.cpp
lld/test/MachO/rebase-opcodes.s [new file with mode: 0644]