Files
clang-p2996/lld/test/MachO/chained-fixups-empty.s
Daniel Bertalan 0d30e92f59 [lld-macho] Add support for emitting chained fixups
This commit adds support for chained fixups, which were introduced in
Apple's late 2020 OS releases. This format replaces the dyld opcodes
used for supplying rebase and binding information, and encodes most of
that data directly in the memory location that will have the fixup
applied.

This reduces binary size and is a requirement for page-in linking, which
will be available starting with macOS 13.

A high-level overview of the format and my implementation can be found
in SyntheticSections.h.

This feature is currently gated behind the `-fixup_chains` flag, and
will be enabled by default for supported targets in a later commit.

Like in ld64, lazy binding is disabled when chained fixups are in use,
and the `-init_offsets` transformation is performed by default.

Differential Revision: https://reviews.llvm.org/D132560
2022-10-04 11:48:45 +02:00

25 lines
815 B
ArmAsm

# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
# RUN: %lld -dylib -fixup_chains -o %t %t.o
# RUN: llvm-objdump --macho --all-headers %t | FileCheck %s
## dyld always expects LC_DYLD_CHAINED_FIXUPS to point to a valid
## chained fixups header, even if there aren't any fixups.
# CHECK: cmd LC_DYLD_CHAINED_FIXUPS
# CHECK-NEXT: cmdsize 16
# CHECK-NEXT: dataoff [[#]]
# CHECK-NEXT: datasize 48
## While ld64 emits the root trie node even if there are no exports,
## setting the data size and offset to zero works too in practice.
# CHECK: cmd LC_DYLD_EXPORTS_TRIE
# CHECK-NEXT: cmdsize 16
# CHECK-NEXT: dataoff 0
# CHECK-NEXT: datasize 0
## Old load commands should not be generated.
# CHECK-NOT: cmd LC_DYLD_INFO_ONLY
_not_exported:
.space 1