Skip to content

Conversation

@zyedidia
Copy link

@zyedidia zyedidia commented Aug 20, 2025

This PR is used for tracking the changes made for the LFI integrated rewriter applied to LLVM 20.1.7. The implementation is based on the NaCl auto-sandboxing assembler, adapted for AArch64 and LFI.

Adds the `aarch64_lfi`, `aarch64_lfi_stores` and `aarch64_lfi_jumps`
subarches for AArch64. Reserves the necessary registers and disables
compressed jump tables when targeting LFI.
This patch establishes the scaffolding for the LFI MC rewriter, based on
the NaCl auto-sandboxing assembler. There is a generic MCLFIExpander,
plus an AArch64-specific subclass where the rewriter will be implemented
in a future patch.
When assembling a .s file using clang or llvm-mc, automatically run the
LFI rewriter if targeting LFI.
@zyedidia zyedidia marked this pull request as draft August 20, 2025 20:31
Doesn't handle basic pre/post-indexed loads/stores yet.
There is a remaining corner case for certain instructions with
hard-coded immediate offset values.
These directives make it possible to disable the LFI rewriter in GNU
assembly.
Removes the aarch64_lfi_stores and aarch64_lfi_jumps target triples and
replaces them with +lfi-stores and +lfi-jumps subtarget features for
AArch64.
Also changes the instruction size estimate to include an additional
guard instruction for loads/stores so that branch relaxation correctly
resizes branches even before the expander is run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants