[all-commits] [llvm/llvm-project] 4ac79a: [lld-macho] Use Symbols as branch target for safe_...
alx32 via All-commits
all-commits at lists.llvm.org
Thu Feb 13 11:07:34 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4ac79a8c988ff74984b78c13d489eafcce9189e5
https://github.com/llvm/llvm-project/commit/4ac79a8c988ff74984b78c13d489eafcce9189e5
Author: alx32 <103613512+alx32 at users.noreply.github.com>
Date: 2025-02-13 (Thu, 13 Feb 2025)
Changed paths:
M lld/MachO/Arch/ARM64.cpp
M lld/MachO/ICF.cpp
M lld/MachO/Target.h
M lld/test/MachO/arm64-thunks.s
Log Message:
-----------
[lld-macho] Use Symbols as branch target for safe_thunks ICF (#126835)
## Problem
The `safe_thunks` ICF optimization in `lld-macho` was creating thunks
that pointed to `InputSection`s instead of `Symbol`s. While, generally,
branch relocations can point to symbols or input sections, in this case
we need them to point to symbols as subsequently the branch extension
algorithm expects branches to always point to `Symbol`'s.
## Solution
This patch changes the ICF implementation so that safe thunks point to
`Symbol`'s rather than `InputSection`s.
## Testing
The existing `arm64-thunks.s` test is modified to include
`--icf=safe_thunks` to explicitly verify the interaction between ICF and
branch range extension thunks. Two functions were added that will be
merged together via a thunk. Before this patch, this test would generate
an assert - now this scenario is correctly handled.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list